经典Java程序源代码模板.doc


文档分类:IT计算机 | 页数:约279页 举报非法文档有奖
1/279
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/279
文档列表 文档介绍
经典Java程序源代码经典Java程序源代码()import.*;import.*;import.*;lassAdderimplementsActionListener{ JFrameAdderFrame; JTextFieldTOprand1; JTextFieldTOprand2; JLabelLAdd,LSum; JButtonBAdd,BClear; JPanelJP1,JP2; publicAdder() { AdderFrame=newJFrame("AdderFrame"); TOprand1=newJTextField(""); TOprand2=newJTextField(""); LAdd=newJLabel("+"); LSum=newJLabel("="); BAdd=newJButton("Add"); BClear=newJButton("Clear"); JP1=newJPanel(); JP2=newJPanel(); (this); (newActionListener() { publicvoidactionPerformed(ActionEventevent) { (""); (""); ("="); } }); (JP1); (TOprand1); (LAdd); (TOprand2); (LSum); (JP2); (BAdd); (BClear); ().setLayout(newBorderLayout()); ().add(JP1,); ().add(JP2,); (newWindowAdapter() { publicvoidwindowClosing(WindowEventevent) { (0); } }); (); (true); (false); (250,100); } publicvoidactionPerformed(ActionEventevent) { doublesum=(double)((()).doubleValue()+(()).doubleValue()); ("="+sum); } publicstaticvoidmain(String[]args) { Adderadder=newAdder(); }}小型记事本(该java源文件由两个类构成,)import.*;import.*;import.*;import.*;classmynotepadextendsJFrame{Filefile=null; Colorcolor=; mynotepad() { initTextContent(); initMenu(); initAboutDialog(); } voidinitTextContent() { getContentPane().add(newJScrollPane(content)); }JTextPanecontent=newJTextPane();JFileChooseropenfile=newJFileChooser();JColorChooseropencolor=newJColorChooser();JDialogabout=newJDialog(this);JMenuBarmenu=newJMenuBar(); //菜单栏的各个菜单项 JMenu[]menus=newJMenu[]{newJMenu("文件"),newJMenu("编辑"),newJMenu("关于")};//"文件"菜单项的四个下拉菜单//编辑菜单的四个下拉菜单 JMenuItemoptionofmenu[][]=newJMenuItem[][]{{newJMenuItem("新建"),newJMenuItem("打开"),newJMenuItem("保存"),newJMenuItem("退出")}, {newJMenuItem("复制"),newJMenuItem("剪切"),newJMenuItem("粘贴"),newJMenuItem("颜色")}, {newJMenuItem("关于")} }; voidinitMenu()

经典Java程序源代码模板 来自淘豆网m.daumloan.com转载请标明出处.

相关文档 更多>>
非法内容举报中心
文档信息
  • 页数279
  • 收藏数0 收藏
  • 顶次数0
  • 上传人梅花书斋
  • 文件大小226 KB
  • 时间2020-02-03