下载

0下载券

加入VIP
  • 专属下载特权
  • 现金文档折扣购买
  • VIP免费专区
  • 千万文档免费下载

上传资料

关闭

关闭

关闭

封号提示

内容

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

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

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

你把我伤的很深_
2017-12-12 0人阅读 举报 0 0 0 暂无简介

简介:本文档为《JAVA大作业个人简介源代码.docdoc》,可适用于战略管理领域

JAVA大作业个人简介源代码docimportjavaawt*importjavaxswing*importjavaawtevent*importjavaio*importjavaxswingevent*SuppressWarnings({"unused","serial"})publicclassMainFrameextendsJFrame{publicstaticContainercontainerpublicstaticJButtonbutton,button,button,button声明个命令按钮对象publicstaticJPanelpanel,panel,panel,panel,panel,panel,panel,panel,panel,panel声明个中间容器publicstaticJLabellabel,label,label,label,label,label,label,label,label,label,label,label,label,label声明个labelpublicstaticJTextFieldt,t,t,t,t声明个TextFieldpublicstaticJCheckBoxckb,ckb,ckb,ckb,ckb,ckb,ckb声明个CheckBoxpublicstaticJRadioButtonrbutton,rbutton声明个JRadioButtonSuppressWarnings("rawtypes")publicstaticJComboBoxfieldComBox,fieldComBox,fieldComBox,fieldComBoxpublicstaticJTextAreajTextArea声明个文本域publicstaticJScrollPanecenterPanel声明滚动面板publicstaticJMenufileMenu,fileMenu,fileMenu声明菜单文件publicstaticJMenuBarmenuBar创建菜单栏publicstaticJMenuItemfileMenu,fileMenu,fileMenu,fileMenu,fileMenu,fileMenu,fileMenu,fileMenupublicstaticJScrollPanejScrollPane,jScrollPane声明滚动条SuppressWarnings("rawtypes")publicstaticJListjListpublicstaticJFileChooserfcSuppressWarnings({"unchecked","rawtypes"})publicMainFrame(){thissetTitle("个人简历设计窗口")设置标题container=thisgetContentPane()获取内容窗格containersetLayout()创建一个标准的命令按钮按钮上的标签提示信息由构造方法中的参数指定fc=newJFileChooser()panel初始化panel=newJPanel()panel=newJPanel()panel=newJPanel()panel=newJPanel()panel=newJPanel()panel=newJPanel()panel=newJPanel()panel=newJPanel()panel=newJPanel()panel=newJPanel()所有panel左对齐panelsetLayout(newFlowLayout(FlowLayoutLEFT))panelsetLayout(newFlowLayout(FlowLayoutLEFT))panelsetLayout(newFlowLayout(FlowLayoutLEFT))panelsetLayout(newFlowLayout(FlowLayoutLEFT))panelsetLayout(newFlowLayout(FlowLayoutLEFT))panelsetLayout(newFlowLayout(FlowLayoutLEFT))panelsetLayout(newFlowLayout(FlowLayoutLEFT))创建列表jList=newJList()jListsetSelectedIndex()jScrollPane=newJScrollPane(jList)paneladd(BorderLayoutCENTER,jScrollPane)jListsetVisibleRowCount()Objectdata={"Java程序设计","VBnet程序设计","网页制作","Flash动画制作","SQL数据库","数据结构"}jListsetListData(data)jListsetSelectedIndex()jListsetSelectionMode(ListSelectionModelMULTIPLEINTERVALSELECTION)设置列表一次只能选择一个菜单文件menuBar=newJMenuBar()创建菜单栏bulidMainMenu(menuBar)自定义组建菜单的方法label初始化label=newJLabel("个人简历")在panel中Fontfont=newFont("",,)字体大小的设置labelsetFont(font)label=newJLabel("姓名:")在panel中label=newJLabel("性别:")label=newJLabel("生日:")在panel中label=newJLabel("年")label=newJLabel("月")label=newJLabel("日")label=newJLabel("年龄:")label=newJLabel("政治面貌:")在panel中label=newJLabel("所学课程:")label=newJLabel("所学专业:")在panel中label=newJLabel("爱好:")在panel中label=newJLabel("毕业院校:")在panel中label=newJLabel("主要事迹:")在lanel中button初始化button=newJButton("提交")button=newJButton("保存")button=newJButton("退出")button=newJButton("清空")为事件注册监听者buttonaddActionListener(newtButtonEventHandle())buttonaddActionListener(newSaveActionListener())buttonaddActionListener(newExitActionListener())buttonaddActionListener(newClearActionListener())JTextField初始化t=newJTextField()t=newJTextField()tsetEditable(false)t=newJTextField()t=newJTextField()t=newJTextField()JCheckBox初始化ckb=newJCheckBox("唱歌")ckb=newJCheckBox("跳舞")ckb=newJCheckBox("乒乓球")ckb=newJCheckBox("篮球")ckb=newJCheckBox("足球")ckb=newJCheckBox("乐器")ckb=newJCheckBox("表演")文本域中添加滚动条文本域组件初始化jTextArea=newJTextArea(,)jTextAreasetEditable(false)将该文本域设为不可编辑的jScrollPane=newJScrollPane(jTextArea)jScrollPanesetHorizontalScrollBarPolicy(JScrollPaneHORIZONTALSCROLLBARALWAYS)jScrollPanesetVerticalScrollBarPolicy(JScrollPaneVERTICALSCROLLBARALWAYS)jTextAreaadd(BorderLayoutCENTER,jScrollPane)JRadioButton初始化rbutton=newJRadioButton("女")rbutton=newJRadioButton("男")将两个RadioButton对象放进ButtonGroup中以实现二选一ButtonGroupbuttonGroup=newButtonGroup()buttonGroupadd(rbutton)buttonGroupadd(rbutton)分类下拉列表出生年份fieldComBox=newJComboBox()为年注册监听者fieldComBoxaddActionListener(newfieldComBox())fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")月fieldComBox=newJComboBox()fieldComBoxaddActionListener(newtFieldComBox())fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")日fieldComBox=newJComboBox()fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")fieldComBoxaddItem("")政治面貌fieldComBox=newJComboBox()fieldComBoxaddItem("请选择")fieldComBoxaddItem("人民群众")fieldComBoxaddItem("中国共青团团员")fieldComBoxaddItem("中国共产党党员")fieldComBoxaddItem("其他民主党派")panel中的组件paneladd(label)paneladd(label)paneladd(t)paneladd(label)paneladd(rbutton)paneladd(rbutton)paneladd(label)paneladd(fieldComBox)paneladd(label)paneladd(fieldComBox)paneladd(label)paneladd(fieldComBox)paneladd(label)paneladd(label)paneladd(t)paneladd(label)paneladd(fieldComBox)paneladd(label)paneladd(jScrollPane)paneladd(label)paneladd(t)paneladd(label)paneladd(ckb)paneladd(ckb)paneladd(ckb)paneladd(ckb)paneladd(ckb)paneladd(ckb)paneladd(ckb)paneladd(label)paneladd(t)paneladd(label)paneladd(t)paneladd(jScrollPane)paneladd(button)paneladd(button)paneladd(button)paneladd(button)设置panel的位置坐标和宽、高panelsetBounds(,,,)panelsetBounds(,,,)panelsetBounds(,,,)panelsetBounds(,,,)panelsetBounds(,,,)panelsetBounds(,,,)panelsetBounds(,,,)panelsetBounds(,,,)panelsetBounds(,,,)panelsetBounds(,,,)*将窗口位置放在屏幕中央*Dimensionscreensize=ToolkitgetDefaultToolkit()getScreenSize()thissetSize(,)Dimensionframesize=thisgetSize()intx=(int)screensizegetWidth()(int)framesizegetWidth()inty=(int)screensizegetHeight()(int)framesizegetHeight()setLocation(x,y)containeradd(panel)containeradd(panel)containeradd(panel)containeradd(panel)containeradd(panel)containeradd(panel)containeradd(panel)containeradd(panel)containeradd(panel)containeradd(panel)thissetJMenuBar(menuBar)将菜单栏挂到该窗口上thissetVisible(true)使窗口出来thissetSize(,)设置窗口大小thissetDefaultCloseOperation(JFrameEXITONCLOSE)关闭窗口时退出系统}构建菜单publicvoidbulidMainMenu(JMenuBarmenuBar){fileMenu=newJMenu("管理")fileMenu=newJMenuItem("提交")fileMenu=newJMenuItem("保存")fileMenu=newJMenuItem("退出")fileMenu=newJMenuItem("清空")fileMenu=newJMenu("颜色")fileMenu=newJMenuItem("红色")fileMenu=newJMenuItem("绿色")fileMenu=newJMenuItem("蓝色")fileMenu=newJMenu("帮助")fileMenu=newJMenuItem("关于")fileMenuaddActionListener(newReferActionListener())为提交增加监听者fileMenuaddActionListener(newSaveActionListener())为保存增加监听者fileMenuaddActionListener(newExitActionListener())为退出增加监听者fileMenuaddActionListener(newClearActionListener())为清空增加监听者fileMenuaddActionListener(newRedActionListener())为红色增加监听者fileMenuaddActionListener(newGreenActionListener())为绿色增加监听者fileMenuaddActionListener(newBlueActionListener())为蓝色增加监听者fileMenuaddActionListener(newAboutActionListener())为关于增加监听者menuBaradd(fileMenu)menuBaradd(fileMenu)menuBaradd(fileMenu)fileMenuadd(fileMenu)fileMenuadd(fileMenu)fileMenuadd(fileMenu)fileMenuadd(fileMenu)fileMenuadd(fileMenu)fileMenuadd(fileMenu)fileMenuadd(fileMenu)fileMenuadd(fileMenu)}年下拉框事件监听者classfieldComBoximplementsActionListener{publicvoidactionPerformed(ActionEvente){Stringstr=(String)fieldComBoxgetSelectedItem()intnn=IntegerparseInt(str)tsetText(StringvalueOf(n))}}publicStringgetsex(){if(rbuttonisSelected())return"男"return"女"}publicStringgetlove(){Stringlove=""if(ckbisSelected())love="唱歌"if(ckbisSelected())love="跳舞"if(ckbisSelected())love="乒乓球"if(ckbisSelected())love="篮球"if(ckbisSelected())love="足球"if(ckbisSelected())love="乐器"if(ckbisSelected())love="表演"returnlove}提交Button事件监听者classtButtonEventHandleimplementsActionListener{publicvoidactionPerformed(ActionEvente){Stringstr=tgetText()Stringstr=(String)fieldComBoxgetSelectedItem()Stringstr=(String)fieldComBoxgetSelectedItem()Stringstr=(String)fieldComBoxgetSelectedItem()Stringstr=tgetText()Stringstr=(String)fieldComBoxgetSelectedItem()Stringstr=jListgetSelectedValuesList()toString()SuppressWarnings("deprecation")Objectff=jListgetSelectedValues()intiStringstr=""for(i=i<fflengthi)str=strffitoString()""Stringstr=tgetText()Stringstr=tgetText()Stringstr=tgetText()jTextAreaappend("姓名:"str"n")jTextAreaappend("性别:"getsex()"n")jTextAreaappend("生日:"str)jTextAreaappend("年"str"月")jTextAreaappend(str"日""n")jTextAreaappend("年龄:"str"n")jTextAreaappend("政治面貌:"str"n")jTextAreaappend("所学课程:"str"n")jTextAreaappend("所学专业:"str"n")jTextAreaappend("爱好:"getlove()"n")jTextAreaappend("毕业院校:"str"n")jTextAreaappend("主要事迹:"str"n")}}菜单中提交菜单项的事件监听者classReferActionListenerimplementsActionListener{publicvoidactionPerformed(ActionEventevent){Stringstr=tgetText()Stringstr=(String)fieldComBoxgetSelectedItem()Stringstr=(String)fieldComBoxgetSelectedItem()Stringstr=(String)fieldComBoxgetSelectedItem()Stringstr=tgetText()Stringstr=(String)fieldComBoxgetSelectedItem()Stringstr=jListgetSelectedValuesList()toString()Stringstr=tgetText()Stringstr=tgetText()Stringstr=tgetText()if(str!=!""equals(str)str!=!""equals(str)str!=!""equals(str)str!=!""equals(str)str!=!""equals(str)str!=!""equals(str)str!=!""equals(str)str!=!""equals(str)str!=!""equals(str)str!=!""equals(str)){JOptionPaneshowConfirmDialog(container,"是否真的要提交,","提示信息",JOptionPaneYESNOOPTION,JOptionPaneQUESTIONMESSAGE)jTextAreaappend("姓名:"str"n")jTextAreaappend("性别:"getsex()"n")jTextAreaappend("生日:"str)jTextAreaappend("年"str"月")jTextAreaappend(str"日""n")jTextAreaappend("年龄:"str"n")jTextAreaappend("政治面貌:"str"n")jTextAreaappend("所学课程:"str"n")jTextAreaappend("所学专业:"str"n")jTextAreaappend("爱好:"getlove()"n")jTextAreaappend("毕业院校:"str"n")jTextAreaappend("主要事迹:"str"n")}else{JOptionPaneshowMessageDialog(container,"提交信息不能为空~","提示信息",JOptionPaneINFORMATIONMESSAGE)}}}菜单中保存菜单项事件监听者classSaveActionListenerimplementsActionListener{publicvoidactionPerformed(ActionEvente){intselect=fcshowSaveDialog(fileMenu)if(select==JFileChooserAPPROVEOPTION){Filefile=fcgetSelectedFile()try{FileWriterfw=newFileWriter(file)fwwrite(jTextAreagetText())fwclose()}catch(IOExceptiona){}Systemoutprintln("文件"filegetName()"被保存")}}}菜单中红色菜单项事件监听者classRedActionListenerimplementsActionListener{publicvoidactionPerformed(ActionEventevent){panelsetBackground(Colorred)panelsetBackground(Colorred)panelsetBackground(Colorred)panelsetBackground(Colorred)panelsetBackground(Colorred)panelsetBackground(Colorred)panelsetBackground(Colorred)panelsetBackground(Colorred)panelsetBackground(Colorred)panelsetBackground(Colorred)containersetBackground(Colorred)}}菜单中绿色菜单项事件监听者classGreenActionListenerimplementsActionListener{publicvoidactionPerformed(ActionEventevent){panelsetBackground(Colorgreen)panelsetBackground(Colorgreen)panelsetBackground(Colorgreen)panelsetBackground(Colorgreen)panelsetBackground(Colorgreen)panelsetBackground(Colorgreen)panelsetBackground(Colorgreen)panelsetBackground(Colorgreen)panelsetBackground(Colorgreen)panelsetBackground(Colorgreen)containersetBackground(Colorgreen)}}菜单中蓝色菜单项事件监听者classBlueActionListenerimplementsActionListener{publicvoidactionPerformed(ActionEventevent){panelsetBackground(Colorblue)panelsetBackground(Colorblue)panelsetBackground(Colorblue)panelsetBackground(Colorblue)panelsetBackground(Colorblue)panelsetBackground(Colorblue)panelsetBackground(Colorblue)panelsetBackground(Colorblue)panelsetBackground(Colorblue)panelsetBackground(Colorblue)containersetBackground(Colorblue)}}菜单中清空菜单项的事件监听者classClearActionListenerimplementsActionListener{publicvoidactionPerformed(ActionEventevent){intresult=JOptionPaneshowConfirmDialog(container,"是否真的清空,","提示信息",JOptionPaneYESNOOPTION,JOptionPaneQUESTIONMESSAGE)if(result==){jTextAreasetText("")}}}菜单中关于菜单项的事件监听者classAboutActionListenerimplementsActionListener{publicvoidactionPerformed(ActionEventevent){Stringmsg="个人简历系统Vn制作日期年月日nByAuther:赵艳辉"Stringtitle="做个好简历找到好工作~"JOptionPaneshowMessageDialog(container,msg,title,JOptionPaneINFORMATIONMESSAGE)}}菜单中退出菜单项的事件监听者classExitActionListenerimplementsActionListener{publicvoidactionPerformed(ActionEventevent){intresult=JOptionPaneshowConfirmDialog(container,"是否真的退出系统的使用,","提示信息",JOptionPaneYESNOOPTION,JOptionPaneQUESTIONMESSAGE)if(result==){Systemexit()}}}publicstaticvoidmain(Stringargs){newMainFrame()}}

用户评价(0)

关闭

新课改视野下建构高中语文教学实验成果报告(32KB)

抱歉,积分不足下载失败,请稍后再试!

提示

试读已结束,如需要继续阅读或者下载,敬请购买!

评分:

/23

VIP

在线
客服

免费
邮箱

爱问共享资料服务号

扫描关注领取更多福利