import java.awt.*;
import javax.swing.*;
public class AiHao extends JFrame{
public static void main(String args[]){
new AiHao();
} JPanel jp1,jp2,jp3;
JLabel jl1,jl2;
JButton jb1,jb2;
JCheckBox jc1,jc2,jc3;
JRadioButton jr1,jr2;
public AiHao(){
jp1=new JPanel();
jp2=new JPanel();
jp3=new JPanel(); jl1=new JLabel("你喜欢的水果");
jl2=new JLabel("你的选择");
jb1=new JButton("提交");
jb1=new JButton("取消"); jc1=new JCheckBox("苹果");
jc2=new JCheckBox("香蕉");
jc3=new JCheckBox("芒果"); jr1=new JRadioButton("是吃");
jr1=new JRadioButton("还是吃啊"); ButtonGroup bg=new ButtonGroup();
bg.add(jr1);
bg.add(jr2);
this.setLayout(new GridLayout(3,1));
jp1.add(jl1);
jp1.add(jc1);
jp1.add(jc2);
jp1.add(jc3); jp2.add(jl2);
jp2.add(jr1);
jp2.add(jr2); jp3.add(jb1);
jp3.add(jb2); this.add(jp1);
this.add(jp2);
this.add(jp3); this.setSize(300,150);
this.setVisible(true);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); ImageIcon icon=new ImageIcon("3.jpg");
this.setIconImage(icon.getImage());
}
}
import javax.swing.*;
public class AiHao extends JFrame{
public static void main(String args[]){
new AiHao();
} JPanel jp1,jp2,jp3;
JLabel jl1,jl2;
JButton jb1,jb2;
JCheckBox jc1,jc2,jc3;
JRadioButton jr1,jr2;
public AiHao(){
jp1=new JPanel();
jp2=new JPanel();
jp3=new JPanel(); jl1=new JLabel("你喜欢的水果");
jl2=new JLabel("你的选择");
jb1=new JButton("提交");
jb1=new JButton("取消"); jc1=new JCheckBox("苹果");
jc2=new JCheckBox("香蕉");
jc3=new JCheckBox("芒果"); jr1=new JRadioButton("是吃");
jr1=new JRadioButton("还是吃啊"); ButtonGroup bg=new ButtonGroup();
bg.add(jr1);
bg.add(jr2);
this.setLayout(new GridLayout(3,1));
jp1.add(jl1);
jp1.add(jc1);
jp1.add(jc2);
jp1.add(jc3); jp2.add(jl2);
jp2.add(jr1);
jp2.add(jr2); jp3.add(jb1);
jp3.add(jb2); this.add(jp1);
this.add(jp2);
this.add(jp3); this.setSize(300,150);
this.setVisible(true);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); ImageIcon icon=new ImageIcon("3.jpg");
this.setIconImage(icon.getImage());
}
}
jr1=new JRadioButton("还是吃啊");改为 jr1=new JRadioButton("是吃");
jr2=new JRadioButton("还是吃啊"); jb1 = new JButton("提交");
jb1 = new JButton("取消");改为
jb1 = new JButton("提交");
jb2 = new JButton("取消");