Possible Duplicate:
Swing: How do I set a component height to the container's height?
how do i divide JPanel like the picture shown below there are 2 panels panel1 and panel2 panel1 should take 70% and panel2 30% or panel1 should be bigger than panel2... I have tried Gridlayout, Border Layout but its not working.any help would be appreciated.
public class TestApplication extends JApplet {
private static final long serialVersionUID = 1L;
JPanel p1,p2;
public void init(){
setLayout(new GridLayout(3,1));
p1=new JPanel();
p2=new JPanel();
p1.setBackground(Color.RED);
p2.setBackground(Color.GREEN);
add(p1);
add(p2);
}
}