Swing实现个人简历
作者:互联网
源码:
import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.Font;
import javax.swing.*;
public class Stu extends JFrame {
public Stu() {
JFrame c= new JFrame();
setLayout(null);//取消布局管理设置
setBounds(0,0,200,150);//窗体整个规模
Container a=getContentPane();//创建容器对象
setTitle("个人信息面板");//定义该窗体的标题
setSize(500,500);//设置窗体大小
setLocation(50, 50);
JLabel s=new JLabel("姓名:");
s.setBounds(10,20,100,30);//姓名标签位置
a.add(s);
JTextField jt=new JTextField();//建立新的文本文件筐
jt.setColumns(40);
jt.setFont(new Font("宋体",Font.PLAIN,20));
a.add(jt);
jt.setBounds(50,25,100,20);
JLabel d=new JLabel("年龄:");
d.setBounds(10,40,100,30);
a.add(d);
JTextField js=new JTextField();
js.setColumns(20);
js.setFont(new Font("宋体",Font.PLAIN,20));
a.add(js);
js.setBounds(50,45,100,20);
JLabel f=new JLabel("专业:");
f.setBounds(10,60,100,30);
a.add(f);
JComboBox<String> comboBox=new JComboBox<String>();
comboBox.setBounds(50,65,130,30);
comboBox.addItem("物联网");
comboBox.addItem("软件工程");
comboBox.addItem("计算机科学与技术");
comboBox.addItem("网络工程");
getContentPane().add(comboBox);
JLabel g=new JLabel("爱好:");
g.setBounds(10,180,100,30);
a.add(g);
JCheckBox c1=new JCheckBox("敲代码");
c1.setBounds(45,180,100,30);
a.add(c1);
JCheckBox c2=new JCheckBox("打篮球");
a.add(c2);
c2.setBounds(105,180,100,30);
JCheckBox c3=new JCheckBox("吃美食");
a.add(c3);
c3.setBounds(170,180,100,30);
JCheckBox c4=new JCheckBox("看小说");
a.add(c4);
c4.setBounds(45,200,100,30);
JCheckBox c5=new JCheckBox("平面设计");
a.add(c5);
c5.setBounds(105,200,100,30);
JCheckBox c6=new JCheckBox("UI设计");
a.add(c6);
c6.setBounds(45,220,100,30);
JCheckBox c7=new JCheckBox("视频剪辑");
a.add(c7);
c7.setBounds(165,220,100,30);
JCheckBox c8=new JCheckBox("棒球");
c8.setBounds(105,220,100,30);
a.add(c8);
JLabel h=new JLabel("民族:");
h.setBounds(10,250,100,30);
a.add(h);
JComboBox<String> comboBox1=new JComboBox<String>();
comboBox1.setBounds(50,250,100,30);
comboBox1.addItem("汉族");
comboBox1.addItem("回族");
comboBox1.addItem("藏族");
comboBox1.addItem("土族");
getContentPane().add(comboBox1);
JLabel j=new JLabel("性别:");
j.setBounds(10,360,100,30);
a.add(j);
JRadioButton jr1=new JRadioButton("男");
JRadioButton jr2=new JRadioButton("女");
jr2.setBounds(100,360,100,30);
a.add(jr2);
jr1.setBounds(40,360,100,30);
a.add(jr1);
setVisible(true);//视窗体可见
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);//设置关闭方式
}
public static void main(String[] args)
{
new Stu();
}
}
运行结果:
标签:JCheckBox,setBounds,个人简历,实现,30,add,Swing,new,100 来源: https://www.cnblogs.com/1314521-ww/p/11072830.html