import javax.swing.*;
import java.awt.*;
public class test extends JFrame{
public test(){
JButton button; //按钮
JLabel label; //标签
JComboBox combobox;//下拉菜单
JCheckBox checkbox;//复选框
JRadioButton radiobutton;//单选框
JTextField textfield;//文本框
button = new JButton("按钮");
label = new JLabel("标签:");
checkbox = new JCheckBox("复选框一");
radiobutton = new JRadioButton("单选框一");
combobox = new JComboBox();
textfield = new JTextField(100);
Container c = this.getContentPane();
c.setLayout(new FlowLayout());
c.add(button);
c.add(label);
c.add(checkbox);
c.add(radiobutton);
combobox.addItem("1");
combobox.addItem("2");
c.add(combobox);
c.add(textfield);
setSize(300, 200);
setVisible(true);
}
public static void main(String[] args) {
// TODO 自动生成方法存根
test mytest = new test();
}
}