import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
public class HelloWorld extends JFrame {
public static void main(String[] args) {
HelloWorld H = new HelloWorld();
H.setVisible(true);
// JOptionPane.showMessageDialog(H, "Printing complete");
}
private JLabel jLabel;
private JTextField jTextField;
private JButton jButton;
private JComboBox jComboBox;
private JPasswordField jPasswordField;
private JCheckBox jCheckBox1;
private JCheckBox jCheckBox2;
private JRadioButton jRadioButton1;
private JRadioButton jRadioButton2;
private JTable jTable;
private JButton jButton2;
public HelloWorld() {
super();
this.setSize(600, 400);
this.getContentPane().setLayout(null);
this.add(getJLabel(), null);
this.add(getJTextField(), null);
this.add(getJButton(), null);
this.add(getJButton2(), null);
this.add(getJComboBox(), null);
this.add(getJPasswordField(), null);
this.add(getJCheckBox1(), null);
this.add(getJCheckBox2(), null);
this.add(getJRadioButton1(), null);
this.add(getJRadioButton2(), null);
this.add(getJTable(), null);
this.setTitle("HelloWorld");
}
private javax.swing.JTable getJTable() {
if (jTable == null) {
jTable = new javax.swing.JTable();
jTable.setBounds(80, 170, 160, 200);
}
return jTable;
}
private javax.swing.JRadioButton getJRadioButton1() {
if (jRadioButton1 == null) {
jRadioButton1 = new javax.swing.JRadioButton("C");
jRadioButton1.setBounds(80, 150, 160, 20);
}
return jRadioButton1;
}
private javax.swing.JRadioButton getJRadioButton2() {
if (jRadioButton2 == null) {
jRadioButton2 = new javax.swing.JRadioButton("C");
jRadioButton2.setBounds(80, 170, 160, 20);
}
return jRadioButton2;
}
private javax.swing.JCheckBox getJCheckBox2() {
if (jCheckBox2 == null) {
jCheckBox2 = new javax.swing.JCheckBox("A");
jCheckBox2.setBounds(400, 110, 160, 20);
jCheckBox2.setMnemonic('A');
}
return jCheckBox2;
}
private javax.swing.JCheckBox getJCheckBox1() {
if (jCheckBox1 == null) {
jCheckBox1 = new javax.swing.JCheckBox("B");
jCheckBox1.setBounds(400, 90, 160, 20);
jCheckBox1.setMnemonic('A');
}
return jCheckBox1;
}
private javax.swing.JPasswordField getJPasswordField() {
if (jPasswordField == null) {
jPasswordField = new javax.swing.JPasswordField();
jPasswordField.setBounds(400, 70, 160, 20);
jPasswordField.setEchoChar('*');
}
return jPasswordField;
}
private javax.swing.JComboBox getJComboBox() {
if (jComboBox == null) {
jComboBox = new javax.swing.JComboBox();
jComboBox.setBounds(400, 49, 160, 20);
jComboBox.addItem('A');
jComboBox.addItem('B');
}
return jComboBox;
}
private javax.swing.JLabel getJLabel() {
if (jLabel == null) {
jLabel = new javax.swing.JLabel();
jLabel.setBounds(34, 49, 53, 18);
jLabel.setText("Name:");
}
return jLabel;
}
private javax.swing.JTextField getJTextField() {
if (jTextField == null) {
jTextField = new javax.swing.JTextField();
jTextField.setBounds(96, 49, 160, 20);
}
return jTextField;
}
private javax.swing.JButton getJButton() {
if (jButton == null) {
jButton = new javax.swing.JButton();
jButton.setBounds(103, 110, 71, 27);
jButton.setText("OK");
jButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
jTextField.setText("a");
JOptionPane.showMessageDialog(jTextField.getParent(),
"Printing complete");
} catch (Exception ee) {
// TODO: handle exception
jTextField.setText(ee.toString());
}
}
});
}
return jButton;
}
private javax.swing.JButton getJButton2() {
if (jButton2 == null) {
jButton2 = new javax.swing.JButton();
jButton2.setBounds(200, 110, 71, 27);
jButton2.setText("QUIT");
jButton2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
System.exit(0);
} catch (Exception ee) {
// TODO: handle exception
jTextField.setText(ee.toString());
}
}
});
}
return jButton2;
}
}