展开全部
10太少了,嘿嘿,先给你一部分把...下面是1/2的代码
package com.netbarview;
import com.downwork.Downput;
import javax.swing.JFrame;
import java.awt.Container;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JMenuItem;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.ImageIcon;
import javax.swing.JRootPane;
public class NetBar extends JFrame {
JMenuBar MenuCarte = new JMenuBar();
JMenu use = new JMenu();
JMenu help = new JMenu();
JMenuItem about = new JMenuItem(new ImageIcon("img/about20.gif"));
JMenu exit = new JMenu();
JMenuItem up = new JMenuItem(new ImageIcon("img/dbup20.gif"));
JMenuItem down = new JMenuItem(new ImageIcon("img/dbdown20.gif"));
JMenuItem exitout = new JMenuItem(new ImageIcon("img/exit20.gif"));
WelComePanel come = new WelComePanel();
public NetBar() {
//添加本窗体的内容面板
come.setBounds(0, 0, 500, 400);
come.setVisible(true);
this.getContentPane().add(come);
try {
jbInit();
} catch (Exception ex) {
ex.printStackTrace();
}
}
class all_ActionListener implements ActionListener {
public void actionPerformed(ActionEvent e) {
String s=e.getActionCommand();
if(s.equals("ab")) {
About abot = new About();
abot.setBounds(300, 300, 280, 170);
abot.setVisible(true);
abot.setTitle("网吧计费管理62616964757a686964616fe78988e69d8331333234333262系统");
} else if(s.equals("ua")){
OnPanel pane = new OnPanel();
pane.setBounds(0, 0, 500, 400);
pane.setVisible(true);
come.setVisible(false);
//getContentPane().remove(come);
getContentPane().add(pane);
NetBar.this.repaint();
}else if(s.equals("dw")) {
Downput dow=new Downput();
dow.setBounds(250, 250, 300, 250);
dow.setVisible(true);
}else if(s.equals("ex")) {
NetBar.this.dispose();
System.exit(0);
}
}
}
private void jbInit() throws Exception {
this.setUndecorated(true);
this.setFocusableWindowState(true);
this.setLocationRelativeTo(this);
this.getRootPane().setWindowDecorationStyle(JRootPane.FRAME); //设置界面风格为Java风格
this.getRootPane().isCursorSet();
this.setLayout(null);
this.setTitle("网吧管理系统");
this.setJMenuBar(MenuCarte);
use.setText("使用");
help.setText("帮助");
exit.setText("退出");
about.setText("关于");
all_ActionListener ab=new all_ActionListener();
about.addActionListener(ab);
about.setActionCommand("ab");
//about_ActionListener ab=new about_ActionListener();
//about.addActionListener(ab);
up.setText("上机");
up.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.
KeyEvent.VK_O, java.awt.event.KeyEvent.CTRL_MASK, false));
up.setActionCommand("ua");
all_ActionListener ua=new all_ActionListener();
up.addActionListener(ua);
//up_ActionListener ua = new up_ActionListener();
//up.addActionListener(ua);
down.setText("下机");
all_ActionListener dw=new all_ActionListener();
down.addActionListener(dw);
down.setActionCommand("dw");
down.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.
KeyEvent.VK_W, java.awt.event.KeyEvent.CTRL_MASK, false));
//down_ActionListener dw=new down_ActionListener();
//down.addActionListener(dw);
exitout.setText("退出");
exitout.setActionCommand("ex");
all_ActionListener ex=new all_ActionListener();
exitout.addActionListener(ex);
exitout.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.
event.KeyEvent.VK_E, java.awt.event.KeyEvent.CTRL_MASK, false));
//exitout_ActionListener ex = new exitout_ActionListener();
//exitout.addActionListener(ex);
MenuCarte.add(use);
MenuCarte.add(help);
MenuCarte.add(exit);
help.add(about);
use.add(up);
use.add(down);
exit.add(exitout);
}
public static void main(String[] args) {
NetBar nb = new NetBar();
nb.setBounds(200, 200, 500, 400);
nb.setVisible(true);
Toolkit tf = Toolkit.getDefaultToolkit();
Image img = tf.getImage("21.JPG");
nb.setIconImage(img);
nb.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//this.setExtendedState(JFrame.MAXIMIZED_BOTH);//默认最大化;
//this.setResizable(false);//用来设置窗口大小不可变;
}
}
package com.netbarview;
import com.database.DbControl;
import javax.swing.JPanel;
已赞过
已踩过<
你对这个回答的评价是?
评论
收起



