java ui awt_分享一个java的UI程序,awt+swing,一个桌球计费系统,按时间计费
发布日期:2021-06-24 16:33:45 浏览次数:4 分类:技术文章

本文共 1717 字,大约阅读时间需要 5 分钟。

package com.weep.mbcs.app;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import javax.swing.JFileChooser;

import javax.swing.JFrame;

import javax.swing.JMenu;

import javax.swing.JMenuBar;

import javax.swing.JMenuItem;

import javax.swing.JOptionPane;

import javax.swing.JTextArea;

import com.weep.mbcs.conf.Constants;

/**

* 窗体菜单.

*

* @author weep

*

*/

public class MyMenu extends JFrame implements ActionListener {

/**

*

*/

private static final long serialVersionUID = 2923564817561058018L;

private JMenuBar jmb;

private JFrame jFrame;

public static ConfigDesk confDesk;

JMenu start, help, config;

JMenuItem copyright, explanation, exit, conf;

JTextArea t;

public MyMenu(JFrame jFrame) {

this.jFrame = jFrame;

this.menuInit();

jFrame.setJMenuBar(jmb);

}

public void menuInit() {

jmb = new JMenuBar();

start = new JMenu("开始");

help = new JMenu("帮助");

conf = new JMenuItem("设置收费标准");

exit = new JMenuItem("退出本系统");

explanation = new JMenuItem("说明");

copyright = new JMenuItem("版权");

jmb.add(start);

jmb.add(help);

start.add(conf);

start.add(exit);

help.add(explanation);

help.add(copyright);

conf.addActionListener(this);

exit.addActionListener(this);

explanation.addActionListener(this);

copyright.addActionListener(this);

t = new JTextArea();

t.setLineWrap(true);

}

public void actionPerformed(ActionEvent e) {

Object o = e.getSource();

JFileChooser f = new JFileChooser();

if (o == copyright) {

JOptionPane.showMessageDialog(this.jFrame, Constants.COPYRIGHT);

return;

}

if (o == explanation) {

JOptionPane.showMessageDialog(this.jFrame, Constants.HELP);

return;

}

if (o == conf) {

jFrame.setVisible(false);

confDesk = new ConfigDesk(jFrame);

return;

}

if (o == exit) {

System.exit(0);

}

}

}

转载地址:https://blog.csdn.net/weixin_33865450/article/details/114835978 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:mysql官网下载ubuntu_ubuntu下安装mysql
下一篇:java走迷宫时间复杂度_走迷宫(栈)-jiuzhuaxiong-ChinaUnix博客

发表评论

最新留言

能坚持,总会有不一样的收获!
[***.219.124.196]2024年04月12日 22时57分46秒