Multiple JPanels completely on top of each other
问题 I am creating an program in which I can draw a map and add different roads etc to it. I have planned to add the map terrain on one jpanel, and the roads etc on another, on top of each other. But I can't get them to work. I don't know how to add multiple jpanels completely on top of each other and making them all able to draw. 回答1: The basic approach to this problem would be to use a JLayeredPane and something like GridBagLayout . The JLayeredPane will give you some better control over the z