import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.Box;
import javax.swing.ButtonGroup;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
public class test implements ActionListener{
public static void main(String args[]){
JFrame frame=new JFrame("Windows");
frame.setBounds(100, 100, 300, 300);
JPanel panel=new JPanel();
JLabel lab1=new JLabel("Interest");
JCheckBox checkbox1=new JCheckBox("yumaoqiu");
JCheckBox checkbox2=new JCheckBox("pingpang");
JCheckBox checkbox3=new JCheckBox("sing");
JLabel lab2=new JLabel("sex");
JRadioButton bt1=new JRadioButton("nan");
JRadioButton bt2=new JRadioButton("nv");
ButtonGroup buttonGroup=new ButtonGroup();
buttonGroup.add(bt1);
buttonGroup.add(bt2);
Box boxV1 = Box.createHorizontalBox();
Box boxV2 = Box.createHorizontalBox();
boxV1.add(lab1);
boxV1.add(checkbox1);
boxV1.add(checkbox2);
boxV1.add(checkbox3);
boxV2.add(lab2);
boxV2.add(bt1);
boxV2.add(bt2);
panel.add(boxV1);
panel.add(boxV2);
panel.setLayout(new GridLayout(2,1));
JScrollPane jspanel=new JScrollPane();
JTextArea txa=new JTextArea();
jspanel.add(txa);
frame.add(panel, BorderLayout.NORTH);
frame.add(jspanel, BorderLayout.CENTER);
frame.setVisible(true);
}
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
}
}
![](https://images2017.cnblogs.com/blog/725061/201711/725061-20171122153528571-2125379055.png)
import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.Box;
import javax.swing.ButtonGroup;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
public class test implements ActionListener{
static private JCheckBox checkbox1=null;
static private JCheckBox checkbox2=null;
static private JCheckBox checkbox3=null;
static private JRadioButton bt1=null;
static private JRadioButton bt2=null;
public static void main(String args[]){
JFrame frame=new JFrame("Windows");
frame.setBounds(100, 100, 300, 300);
JPanel panel=new JPanel();
JLabel lab1=new JLabel("Interest");
checkbox1=new JCheckBox("yumaoqiu");
checkbox2=new JCheckBox("pingpang");
checkbox3=new JCheckBox("sing");
JLabel lab2=new JLabel("sex");
bt1=new JRadioButton("nan");
bt2=new JRadioButton("nv");
ButtonGroup buttonGroup=new ButtonGroup();
buttonGroup.add(bt1);
buttonGroup.add(bt2);
Box boxV1 = Box.createHorizontalBox();
Box boxV2 = Box.createHorizontalBox();
boxV1.add(lab1);
boxV1.add(checkbox1);
boxV1.add(checkbox2);
boxV1.add(checkbox3);
boxV2.add(lab2);
boxV2.add(bt1);
boxV2.add(bt2);
panel.add(boxV1);
panel.add(boxV2);
panel.setLayout(new GridLayout(2,1));
JScrollPane jspanel=new JScrollPane();
JTextArea txa=new JTextArea();
jspanel.add(txa);
frame.add(panel, BorderLayout.NORTH);
frame.add(jspanel, BorderLayout.CENTER);
frame.setVisible(true);
}
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
}
}