摘要: import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import javax.swing.JFrame; package cumin.planewar; import java.awt.Color; import ja 阅读全文
posted @ 2016-05-27 16:00 Gentleman` 阅读(157) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2016-05-27 15:56 Gentleman` 阅读(106) 评论(0) 推荐(0) 编辑
摘要: 抽奖程序: 结果如下: 阅读全文
posted @ 2016-05-12 16:48 Gentleman` 阅读(166) 评论(0) 推荐(0) 编辑
摘要: 结果截图: 阅读全文
posted @ 2016-04-15 19:56 Gentleman` 阅读(289) 评论(2) 推荐(0) 编辑
摘要: import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; public class Test {public static voi 阅读全文
posted @ 2016-04-08 20:15 Gentleman` 阅读(214) 评论(0) 推荐(0) 编辑
摘要: 运行结果: 阅读全文
posted @ 2016-03-28 19:08 Gentleman` 阅读(161) 评论(0) 推荐(0) 编辑
摘要: 组合框(JComboBox)的使用方法:组合框(JComboBox)是文本框和列表的组合,可以在文本框中输入选项,也可以单击下拉按钮从显示的列表中进行选择。组合框的常用构造方法:JComboBox():建立一个没有选项的JComboBox对象。JComboBox(JComboBoxModel aMo 阅读全文
posted @ 2016-03-18 18:29 Gentleman` 阅读(379) 评论(1) 推荐(0) 编辑
摘要: 可以是按钮,可以是任何的面板对象Container cp = getContentPane();//设置一个容器cp.setLayout( new GridLayout(5,4,10,10));//设置容器样式JButton btn1 = new JButton("1") ;//创建一个按钮cp.a 阅读全文
posted @ 2016-03-13 16:32 Gentleman` 阅读(352) 评论(0) 推荐(0) 编辑
摘要: Java语言的GUI的构建工具分为“部件”和“容器”; 部件有:按钮,标签,复选框,单选按钮,选择框,列表框,文本框,滚动条,画布,菜单; 容器有:程序的启动封面,窗体,对话框 ; 使用Java开发GUI程序,一般步骤为: 1.构建一个顶层容器; 2.构建一个部件; 3.用容器的add方法将部件加入 阅读全文
posted @ 2016-03-13 16:18 Gentleman` 阅读(116) 评论(0) 推荐(0) 编辑