Tuesday, September 8, 2015

Sample Objects of different Classes

Classes used to create the above components are as follows:

Component NameClass Name
FrameJFrame
PanelJPanel
ButtonJButton
LabelJLabel
TextFieldJTextField
RadioButtonJRadioButton
ChekBoxJCheckBox
ComboBoxJComboBox



JFrame frame = new JFrame("Welcome");

JPanel panel = new JPanel();

JLabel lblusername = new JLabel("User Name");

JTextField txtusername = new JTextField(30);

JButton btnOk = new JButton("OK");

JRadioButton rbMale = new JRadioButton();

JCheckBox cbHobby = new JCheckBox();

JComboBox cbxCity = new JComboBox();

No comments:

Post a Comment