Hi
This the code i have written
package Swing;
import javax.swing.*;
import java.awt.*;
public class JCheckBoxTest
{
JCheckBox ch;
JButton b1;
JPanel p,p1;
JFrame f;
JCheckBoxTest()
{
f=new JFrame();
f.setLayout(new FlowLayout());
p=new JPanel();
p1=new JPanel();
b1=new JButton("Press");
ch=new JCheckBox("Red");
p.add(ch);
p1.add(b1, 0);
f.getContentPane().add(p);
f.getContentPane().add(p1);
f.setSize(400,500);
f.setVisible(true);
}
public static void main(
String[] args)
{
new JCheckBoxTest();
}
}
now when i am running it it is showing both checkbox and button in the same line .Like one after another.I dont want that.
How to make button to come to next line or at the bottom?