JAVA创建用户界面的简单应用例子 按钮 菜单
(1)窗口有“退出”菜单,选择后可退出程序
(2) 窗口内有“提示”按钮,单击后显示自己的班级、学号、姓名
(3) “退出”按钮,单击后可退出程序
(4)在窗口内实现一个计算器,可进行简单的加、减、乘、除操作
能发到本人邮箱吗?谢谢了。710934613@qq.com 展开
你好!很高兴为你解答疑惑。
首先,我已将程序写出来,待会发到你邮箱(代码+可运行文件)。
其次,在此将其中的一个类粘贴出来,展示代码。项目全部内容请查看我的空间:
http://hi.baidu.com/%E5%8F%B6%E7%A7%91%E8%89%AF/ihome/myblog
*********************************************
/*
* MyCalculatorApp.java
*/
package mycalculator;
import org.jdesktop.application.Application;
import org.jdesktop.application.SingleFrameApplication;
/**
* The main class of the application.
*/
public class MyCalculatorApp extends SingleFrameApplication {
/**
* At startup create and show the main frame of the application.
*/
@Override protected void startup() {
show(new MyCalculatorView(this));
}
/**
* This method is to initialize the specified window by injecting resources.
* Windows shown in our application come fully initialized from the GUI
* builder, so this additional configuration is not needed.
*/
@Override protected void configureWindow(java.awt.Window root) {
}
/**
* A convenient static getter for the application instance.
* @return the instance of MyCalculatorApp
*/
public static MyCalculatorApp getApplication() {
return Application.getInstance(MyCalculatorApp.class);
}
/**
* Main method launching the application.
*/
public static void main(String[] args) {
launch(MyCalculatorApp.class, args);
}
}
希望可以帮到你!