首页 JAVA大作业个人简介源代码.doc

JAVA大作业个人简介源代码.doc

举报
开通vip

JAVA大作业个人简介源代码.docJAVA大作业个人简介源代码.doc import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.io.*; import javax.swing.event.*; @SuppressWarnings({ "unused", "serial" }) public class MainFrame extends JFrame{ public static Container container; publi...

JAVA大作业个人简介源代码.doc
JAVA大作业个人简介源代码.doc import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.io.*; import javax.swing.event.*; @SuppressWarnings({ "unused", "serial" }) public class MainFrame extends JFrame{ public static Container container; public static JButton button1,button2,button3,button4;//声明4个命令按钮对象 public static JPanel panel1,panel2,panel3,panel4,panel5,panel6,panel7,panel8,panel9,panel10;//声明10个中间容器 public static JLabel label1,label2,label3,label4,label5,label6,label7,label8,label9,label10,label11,label12,label13,label1 4; //声明14个label public static JTextField t1,t2,t3,t4,t5;//声明5个TextField public static JCheckBox ckb1,ckb2,ckb3,ckb4,ckb5,ckb6,ckb7;//声明7个CheckBox public static JRadioButton rbutton1,rbutton2;//声明2个JRadioButton @SuppressWarnings("rawtypes") public static JComboBox fieldComBox1,fieldComBox2,fieldComBox3,fieldComBox4; public static JTextArea jTextArea1;//声明1个文本域 public static JScrollPane centerPanel;//声明滚动面板 public static JMenu fileMenu1,fileMenu6,fileMenu10;//声明菜单文件 public static JMenuBar menuBar;//创建菜单栏 public static JMenuItem fileMenu2,fileMenu3,fileMenu4,fileMenu5,fileMenu7,fileMenu8,fileMenu9,fileMenu11; public static JScrollPane jScrollPane1,jScrollPane2;//声明滚动条 @SuppressWarnings("rawtypes") public static JList jList; public static JFileChooser fc; @SuppressWarnings({ "unchecked", "rawtypes" }) public MainFrame(){ this.setTitle("个人 简历 个人简历下载免费下载简历模版总经理简历下载资料员简历下载资料员简历下载 设计窗口");//设置标题 container=this.getContentPane();//获取内容窗格 container.setLayout(null);//创建一个标准的命令按钮, //按钮上的标签提示信息由构造方法中的参数指定 fc=new JFileChooser(); //panel初始化 panel1=new JPanel(); panel2=new JPanel(); panel3=new JPanel(); panel4=new JPanel(); panel5=new JPanel(); panel6=new JPanel(); panel7=new JPanel(); panel8=new JPanel(); panel9=new JPanel(); panel10=new JPanel(); //所有panel左对齐 panel2.setLayout(new FlowLayout(FlowLayout.LEFT)); panel3.setLayout(new FlowLayout(FlowLayout.LEFT)); panel4.setLayout(new FlowLayout(FlowLayout.LEFT)); panel5.setLayout(new FlowLayout(FlowLayout.LEFT)); panel6.setLayout(new FlowLayout(FlowLayout.LEFT)); panel7.setLayout(new FlowLayout(FlowLayout.LEFT)); panel8.setLayout(new FlowLayout(FlowLayout.LEFT)); //创建列表 jList=new JList(); jList.setSelectedIndex(3); jScrollPane2=new JScrollPane(jList); panel4.add(BorderLayout.CENTER,jScrollPane2); jList.setVisibleRowCount(3); Object data[] ={"Java程序设计","VB.net程序设计","网页制作","Flash动画制作 ","SQL数据库","数据结构"}; jList.setListData(data); jList.setSelectedIndex(0); jList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);// 设置列表一次只能选择一个 //菜单文件 menuBar=new JMenuBar();//创建菜单栏 bulidMainMenu(menuBar);//自定义组建菜单的方法 //label初始化 label1=new JLabel("个人简历");//在panel1中 Font font = new Font("",10,30);//字体大小的设置 label1.setFont(font); label2=new JLabel("姓名:");//在panel2中 label3=new JLabel("性别:"); label4=new JLabel("生日:");//在panel3中 label5=new JLabel("年"); label6=new JLabel("月"); label7=new JLabel("日"); label8=new JLabel("年龄:"); label9=new JLabel("政治面貌:");//在panel4中 label10=new JLabel("所学课程:"); label11=new JLabel("所学专业:");//在panel5中 label12=new JLabel("爱好:");//在panel6中 label13=new JLabel("毕业院校:");//在panel7中 label14=new JLabel("主要事迹:");//在lanel8中 //button初始化 button1=new JButton("提交"); button2=new JButton("保存"); button3=new JButton("退出"); button4=new JButton("清空"); //为事件注册监听者 button1.addActionListener(new tButtonEventHandle()); button2.addActionListener(new SaveActionListener()); button3.addActionListener(new ExitActionListener()); button4.addActionListener(new ClearActionListener()); //JTextField初始化 t1=new JTextField(25); t2=new JTextField(5); t2.setEditable(false); t3=new JTextField(35); t4=new JTextField(35); t5=new JTextField(36); //JCheckBox初始化 ckb1=new JCheckBox("唱歌"); ckb2=new JCheckBox("跳舞"); ckb3=new JCheckBox("乒乓球"); ckb4=new JCheckBox("篮球"); ckb5=new JCheckBox("足球"); ckb6=new JCheckBox("乐器"); ckb7=new JCheckBox("表演"); //文本域中添加滚动条 //文本域组件初始化 jTextArea1=new JTextArea(8,40); jTextArea1.setEditable(false);//将该文本域设为不可编辑的 jScrollPane1=new JScrollPane(jTextArea1); jScrollPane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AL WAYS); jScrollPane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS) ; //jTextArea1.add(BorderLayout.CENTER,jScrollPane1); //JRadioButton初始化 rbutton1=new JRadioButton("女"); rbutton2=new JRadioButton("男"); //将两个RadioButton对象放进ButtonGroup中,以实现二选一 ButtonGroup buttonGroup1=new ButtonGroup(); buttonGroup1.add(rbutton1); buttonGroup1.add(rbutton2); //分类下拉列表 //出生年份 fieldComBox1=new JComboBox(); //为年注册监听者 fieldComBox1.addActionListener(new fieldComBox1()); fieldComBox1.addItem("1980"); fieldComBox1.addItem("1981"); fieldComBox1.addItem("1982"); fieldComBox1.addItem("1983"); fieldComBox1.addItem("1984"); fieldComBox1.addItem("1985"); fieldComBox1.addItem("1986"); fieldComBox1.addItem("1987"); fieldComBox1.addItem("1988"); fieldComBox1.addItem("1989"); fieldComBox1.addItem("1990"); fieldComBox1.addItem("1991"); fieldComBox1.addItem("1992"); fieldComBox1.addItem("1993"); fieldComBox1.addItem("1994"); fieldComBox1.addItem("1995"); fieldComBox1.addItem("1996"); fieldComBox1.addItem("1997"); fieldComBox1.addItem("1998"); fieldComBox1.addItem("1999"); fieldComBox1.addItem("2000"); fieldComBox1.addItem("2001"); //月 fieldComBox2=new JComboBox(); //fieldComBox2.addActionListener(new tFieldComBox2()); fieldComBox2.addItem("1"); fieldComBox2.addItem("2"); fieldComBox2.addItem("3"); fieldComBox2.addItem("4"); fieldComBox2.addItem("5"); fieldComBox2.addItem("6"); fieldComBox2.addItem("7"); fieldComBox2.addItem("8"); fieldComBox2.addItem("9"); fieldComBox2.addItem("10"); fieldComBox2.addItem("11"); fieldComBox2.addItem("12"); //日 fieldComBox3=new JComboBox(); fieldComBox3.addItem("1"); fieldComBox3.addItem("2"); fieldComBox3.addItem("3"); fieldComBox3.addItem("4"); fieldComBox3.addItem("5"); fieldComBox3.addItem("6"); fieldComBox3.addItem("7"); fieldComBox3.addItem("8"); fieldComBox3.addItem("9"); fieldComBox3.addItem("10"); fieldComBox3.addItem("11"); fieldComBox3.addItem("12"); fieldComBox3.addItem("13"); fieldComBox3.addItem("14"); fieldComBox3.addItem("15"); fieldComBox3.addItem("16"); fieldComBox3.addItem("17"); fieldComBox3.addItem("18"); fieldComBox3.addItem("19"); fieldComBox3.addItem("20"); fieldComBox3.addItem("21"); fieldComBox3.addItem("22"); fieldComBox3.addItem("23"); fieldComBox3.addItem("24"); fieldComBox3.addItem("25"); fieldComBox3.addItem("26"); fieldComBox3.addItem("27"); fieldComBox3.addItem("28"); fieldComBox3.addItem("29"); fieldComBox3.addItem("30"); fieldComBox3.addItem("31"); //政治面貌 fieldComBox4=new JComboBox(); fieldComBox4.addItem("请选择..."); fieldComBox4.addItem("人民群众"); fieldComBox4.addItem("中国共青团团员"); fieldComBox4.addItem("中国共产党党员"); fieldComBox4.addItem("其他民主党派"); //panel中的组件 panel1.add(label1); panel2.add(label2); panel2.add(t1); panel2.add(label3); panel2.add(rbutton1); panel2.add(rbutton2); panel3.add(label4); panel3.add(fieldComBox1); panel3.add(label5); panel3.add(fieldComBox2); panel3.add(label6); panel3.add(fieldComBox3); panel3.add(label7); panel3.add(label8); panel3.add(t2); panel4.add(label9); panel4.add(fieldComBox4); panel4.add(label10); panel4.add(jScrollPane2); panel5.add(label11); panel5.add(t3); panel6.add(label12); panel6.add(ckb1); panel6.add(ckb2); panel6.add(ckb3); panel6.add(ckb4); panel6.add(ckb5); panel6.add(ckb6); panel6.add(ckb7); panel7.add(label13); panel7.add(t4); panel8.add(label14); panel8.add(t5); panel9.add(jScrollPane1); panel10.add(button1); panel10.add(button2); panel10.add(button3); panel10.add(button4); //设置panel的位置坐标和宽、高 panel1.setBounds(50, 10, 500, 40); panel2.setBounds(50, 60, 500, 40); panel3.setBounds(50, 110, 500, 40); panel4.setBounds(50, 160, 500, 80); panel5.setBounds(50, 270, 500, 40); panel6.setBounds(50, 320, 500, 40); panel7.setBounds(50, 370, 500, 40); panel8.setBounds(50, 420, 500, 40); panel9.setBounds(20, 470, 550, 200); panel10.setBounds(50, 680, 500, 40); /*将窗口位置放在屏幕中央*/ Dimension screensize=Toolkit.getDefaultToolkit().getScreenSize(); this.setSize(600, 800); Dimension framesize=this.getSize(); int x=(int)screensize.getWidth()/2-(int)framesize.getWidth()/2; int y=(int)screensize.getHeight()/2-(int)framesize.getHeight()/2; setLocation(x,y); container.add(panel1); container.add(panel2); container.add(panel3); container.add(panel4); container.add(panel5); container.add(panel6); container.add(panel7); container.add(panel8); container.add(panel9); container.add(panel10); this.setJMenuBar(menuBar);//将菜单栏挂到该窗口上 this.setVisible(true);//使窗口出来 this.setSize(600, 800);//设置窗口大小 this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//关闭窗口时退出系统 } //构建菜单 public void bulidMainMenu(JMenuBar menuBar){ fileMenu1=new JMenu("管理"); fileMenu2=new JMenuItem("提交"); fileMenu3=new JMenuItem("保存"); fileMenu4=new JMenuItem("退出"); fileMenu5=new JMenuItem("清空"); fileMenu6=new JMenu("颜色"); fileMenu7=new JMenuItem("红色"); fileMenu8=new JMenuItem("绿色"); fileMenu9=new JMenuItem("蓝色"); fileMenu10=new JMenu("帮助"); fileMenu11=new JMenuItem("关于"); fileMenu2.addActionListener(new ReferActionListener());//为提交增加监听者 fileMenu3.addActionListener(new SaveActionListener());//为保存增加监听者 fileMenu4.addActionListener(new ExitActionListener());//为退出增加监听者 fileMenu5.addActionListener(new ClearActionListener());//为清空增加监听者 fileMenu7.addActionListener(new RedActionListener());//为红色增加监听者 fileMenu8.addActionListener(new GreenActionListener());//为绿色增加监听者 fileMenu9.addActionListener(new BlueActionListener());//为蓝色增加监听者 fileMenu11.addActionListener(new AboutActionListener());//为关于增加监听者 menuBar.add(fileMenu1); menuBar.add(fileMenu6); menuBar.add(fileMenu10); fileMenu1.add(fileMenu2); fileMenu1.add(fileMenu3); fileMenu1.add(fileMenu4); fileMenu1.add(fileMenu5); fileMenu6.add(fileMenu7); fileMenu6.add(fileMenu8); fileMenu6.add(fileMenu9); fileMenu10.add(fileMenu11); } //年下拉框事件监听者 class fieldComBox1 implements ActionListener{ public void actionPerformed(ActionEvent e){ String str=(String)fieldComBox1.getSelectedItem(); int n; n=2012-Integer.parseInt(str); t2.setText(String.valueOf(n)); } } // public String getsex(){ if(rbutton2.isSelected()) return "男"; return "女"; } // public String getlove(){ String love=""; if(ckb1.isSelected()) love+= "唱歌 "; if(ckb2.isSelected()) love+= "跳舞 "; if(ckb3.isSelected()) love+= "乒乓球 "; if(ckb4.isSelected()) love+= "篮球 "; if(ckb5.isSelected()) love+= "足球 "; if(ckb6.isSelected()) love+= "乐器 "; if(ckb7.isSelected()) love+= "表演 "; return love; } //提交Button事件监听者 class tButtonEventHandle implements ActionListener{ public void actionPerformed(ActionEvent e){ String str1=t1.getText(); String str2=(String)fieldComBox1.getSelectedItem(); String str3=(String)fieldComBox2.getSelectedItem(); String str4=(String)fieldComBox3.getSelectedItem(); String str5=t2.getText(); String str6=(String)fieldComBox4.getSelectedItem(); String str7=jList.getSelectedValuesList().toString(); // @SuppressWarnings("deprecation") // Object[] ff=jList.getSelectedValues(); // int i; // String str7=""; // for(i=0;i
本文档为【JAVA大作业个人简介源代码.doc】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_686908
暂无简介~
格式:doc
大小:57KB
软件:Word
页数:23
分类:企业经营
上传时间:2017-12-12
浏览量:64