I need to get two JPanels into one JApplet.
paneel = new RekenmachinePaneel();
nummer = new NummerPaneel();
setContentPane(paneel);
Now I need to get the nummer panel to show up beneath the paneel. How should I do that?
I need to get two JPanels into one JApplet.
paneel = new RekenmachinePaneel();
nummer = new NummerPaneel();
setContentPane(paneel);
Now I need to get the nummer panel to show up beneath the paneel. How should I do that?
Make the layout as null.
paneel.setLayout(null);
nummer.setLayout(null);
By setting the layouts to null, you can move any panels over any panel. But its not recommended as you will not be using the power of layouts (form, border, box etc.,)
Also you would need to the location of the panels properly.
paneel.setLocation(x2,y2);
nummer.setLocation(x1,y1);
You can use a layout to position them.
setLayout(new GridLayout(0,1));
add(paneel);
add(nummer);
If you want to add both panels you will have to create a third one:
JPanel myPanel = new JPanel();
myPanel.add(paneel);
myPanel.add(nummer);
setContentPane(myPanel);
If you want to get the number of panels you have inside an specific component use this:
int no = yourComponent.getComponents().length;