Home > Back-end >  Java errors can't find symbols. No question why always prompt error code cannot find symbols, e
Java errors can't find symbols. No question why always prompt error code cannot find symbols, e

Time:04-19

Package diyiti;

Public class Example11_3 {

Public static void main (String [] args) {
ComponentInWindow win=new ComponentInWindow ();
Win the setBounds (100100310260);
Win. SetTitle (" common components ");


}

}

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Package diyiti;
Import the Java. The awt. *;
The import javax.mail. Swing. *;
Public class ComponentInWindow extends JFrame {
JTextField text;
JButton button;
JCheckBox checkBox1, checkBox2 checkBox3;
JRadioButton radio1 radio2;
ButtonGroup group;
JComboBox comBox;
JTextArea area;
Public ComponentInWindow () {
init();
SetVisible (true);
SetDefaultCloseOperation (JFrame. EXIT_ON_CLOSE);
}
Void init () {
SetLayout (new FlowLayout ());
Add (new JLabel (" text box: "));
Text=new JTextField (10);
Add (text);
Add (new JLabel (" button: "));
The button=new JButton (" ok ");
Add (button);
Add (new JLabel (" select box: "));
CheckBox1=new JCheckBox (" love music ");
CheckBox2=new JCheckBox (" like to travel ");
CheckBox3=new JCheckBox (" like basketball ");
Add (checkBox1);
Add (checkBox2);
Add (checkBox3);
Add (new JLabel (" radio button: "));
Group=new ButtonGroup ();
Radio1=new JRadioButton (" male ");
Radio2=new JRadioButton (" female ");
Group. The add (radio1);
Group. The add (radio2);
Add (radio1);
Add (radio2);
Add (new JLabel (" drop-down list: "));
ComBox=new JComboBox ();
ComBox. AddItem (" music world ");
ComBox. AddItem (" martial arts world ");
ComBox. AddItem (" chess paradise ");
Add (comBox);
Add (new JLabel (" text area: "));
Area=new JTextArea (6, 13);
Add (new JScrollPane (area));

}
}
  • Related