import javax.swing.*;
public class GUIComponents
{
public static void main(String a[])
{
JButton jbtOK = new JButton("OK");
JLabel jlblName =new JLabel("Enter ur name : ");
JTextField jtfName = new JTextField("Type name here : ");
JCheckBox jchkBox = new JCheckBox("Bold");
JRadioButton jrbRed = new JRadioButton("Red");
JComboBox jcboColor = new JComboBox(new String[]{"Red","Green","Blue"});
JPanel panel = new JPanel();
panel.add(jbtOK);
panel.add(jlblName);
panel.add(jtfName);
panel.add(jchkBox);
panel.add(jrbRed);
panel.add(jcboColor);
JFrame frame = new JFrame();
frame.add(panel);
frame.setTitle("Show GUI Components ");
frame.setSize(450,100);
frame.setLocation(200,100);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
public class GUIComponents
{
public static void main(String a[])
{
JButton jbtOK = new JButton("OK");
JLabel jlblName =new JLabel("Enter ur name : ");
JTextField jtfName = new JTextField("Type name here : ");
JCheckBox jchkBox = new JCheckBox("Bold");
JRadioButton jrbRed = new JRadioButton("Red");
JComboBox jcboColor = new JComboBox(new String[]{"Red","Green","Blue"});
JPanel panel = new JPanel();
panel.add(jbtOK);
panel.add(jlblName);
panel.add(jtfName);
panel.add(jchkBox);
panel.add(jrbRed);
panel.add(jcboColor);
JFrame frame = new JFrame();
frame.add(panel);
frame.setTitle("Show GUI Components ");
frame.setSize(450,100);
frame.setLocation(200,100);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
No comments:
Post a Comment