📄 wangbasystemmanage.txt
字号:
http://hexun.com/xplu20000 > 复制 > 收藏 | 移动个人门户 和讯博客 | 和讯首页我们的骄傲,多半基于我们的无知!
付出总有回报~个人门户博客相册音乐视频网摘博揽邮局朋友圈好友留言板进入我的家主人:xplu20000
[发送私信] [加为好友] [关注]
欢迎光临来到的我BLOG,如果里面的文章对您有用,别忘帮踩下哈~ 回贴是美德~~
快速链接
[和讯博客]
[发表文章]
[进入管理]
搜索
分类
友情链接
大唐PHOTOSHOP资源下载
微软帮助和直持
我爱山核桃的BLOG
中国人机界面设计专业门户
中国最大的IT技术社区
JAVA编写一个简单的网吧管理系统 [原创 2007-01-08 21:35:31 ] 发表者: xplu20000
package com.netbarview;
/**
* <p>Title:主界面(程序主界面) </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2006</p>
*
* <p>Company: ACCP</p>
*
* @author xplu20000
* @version 1.0
*/
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("网吧计费管理系统");
} 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);
}
}
}
/*class up_ActionListener implements ActionListener {
public void actionPerformed(ActionEvent e) {
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();
}
}
class down_ActionListener implements ActionListener {
public void actionPerformed(ActionEvent e) {
Downput dow=new Downput();
dow.setBounds(250,250,300,250);
dow.setVisible(true);
}
}
class about_ActionListener implements ActionListener {
public void actionPerformed(ActionEvent e) {
About abot = new About();
abot.setBounds(300,300,280,170);
abot.setVisible(true);
abot.setTitle("网吧计费管理系统");
}
}*/
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;
/**
* <p>Title:上机界面 </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2006</p>
*
* <p>Company: ACCP</p>
*
* @author xplu20000
* @version 1.0
*/
import com.database.DbControl;
import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.JButton;
import javax.swing.JTextField;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Date;
import java.util.Calendar;
import java.text.SimpleDateFormat;
import javax.swing.JOptionPane;
import javax.swing.JComboBox;
import javax.swing.JPasswordField;
import java.awt.Font;
import java.util.ArrayList;
import com.intermedium.*;
import javax.swing.ImageIcon;
public class OnPanel extends JPanel
{
JLabel labjph = new JLabel();
JLabel labontime = new JLabel();
JTextField txttime = new JTextField();
JLabel labcard = new JLabel();
JTextField txtcard = new JTextField();
JButton btnok = new JButton(new ImageIcon("img/xiu.gif"));
JComboBox cbojph = new JComboBox();
JPasswordField password = new JPasswordField();
JLabel labpassword = new JLabel();
Calendar tm = Calendar.getInstance();
SimpleDateFormat tm1 = new SimpleDateFormat("yyyy-MM-dd k:mm:ss");
//Date ti = new Date();
Card ca=new Card();
Computer comp=new Computer();
Record re=new Record();
class btnok_ActionEvent implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
if((txtcard.getText().length()==0))
{
JOptionPane.showMessageDialog(null,"请输入机器号和卡号");
}
else
{ //获取时间;
String tim = tm1.format(tm.getTime()); //+" "+ ti.toString().substring(11,16);
txttime.setText(tim);
//验证卡号和密码;
ca.setID(txtcard.getText().trim());
char[] pa=password.getPassword();
String pas=new String(pa);
ca.setPassword(pas);
boolean flag=DbControl.validate(ca);
if(flag) {
JOptionPane.showMessageDialog(null,"登陆成功");
re.setCardID(txtcard.getText().trim());
re.setComputerID(cbojph.getSelectedItem().toString());
re.setBeginTime(txttime.getText());
comp.SetID(cbojph.getSelectedItem().toString());
DbControl.insertBe(comp,re);
} else {
JOptionPane.showMessageDialog(null,"对不起,卡号或密码有误");
}
}
}
}
public OnPanel()
{
this.setLayout(null);
try {
jbInit();
} catch (Exception ex) {
ex.printStackTrace();
}
}
private void jbInit() throws Exception {
labjph.setFont(new java.awt.Font("宋体", Font.PLAIN, 15));
labjph.setText("机器号:");
labjph.setBounds(new Rectangle(144, 51, 63, 21));
labontime.setFont(new java.awt.Font("宋体", Font.PLAIN, 15));
labontime.setText("上机日期:");
labontime.setBounds(new Rectangle(134, 205, 69, 22));
txttime.setEditable(false);
txttime.setBounds(new Rectangle(211, 200, 110, 25));
labcard.setFont(new java.awt.Font("宋体", Font.PLAIN, 15));
labcard.setText("卡 号:");
labcard.setBounds(new Rectangle(144, 103, 58, 27));
txtcard.setBounds(new Rectangle(211, 100, 110, 25));
btnok.setBounds(new Rectangle(172, 252, 110, 35));
btnok.setText("确定");
btnok_ActionEvent okobj=new btnok_ActionEvent();
btnok.addActionListener(okobj);
cbojph.setBounds(new Rectangle(211, 49, 110, 24));
ArrayList lis=DbControl.selectDown();
for(int i=0;i<lis.size();i++) {
String nos=(String)lis.get(i);
cbojph.addItem(nos);
}
password.setBounds(new Rectangle(212, 150, 110, 25));
labpassword.setFont(new java.awt.Font("宋体", Font.PLAIN, 15));
labpassword.setText("密 码:");
labpassword.setBounds(new Rectangle(144, 143, 65, 38));
this.add(btnok);
this.add(password);
this.add(labontime);
this.add(labjph);
this.add(txttime);
this.add(cbojph);
this.add(labpassword);
this.add(txtcard);
this.add(labcard);
}
}
-----------------------------------------------------------------文件分界线---------------------------------------------------------------------------------
package com.netbarview;
/**
* <p>Title:欢迎界面 </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2006</p>
*
* <p>Company: ACCP</p>
*
* @author xplu20000
* @version 1.0
*/
import javax.swing.JPanel;
import javax.swing.JLabel;
import java.awt.Rectangle;
import java.awt.Font;
public class WelComePanel extends JPanel {
JLabel labcome = new JLabel();
JLabel labmake = new JLabel();
public WelComePanel() {
try {
jbInit();
} catch (Exception ex) {
ex.printStackTrace();
}
}
private void jbInit() throws Exception {
this.setLayout(null);
labcome.setFont(new java.awt.Font("幼圆", Font.BOLD, 22));
labcome.setText("欢迎使用网吧计费管理系统");
labcome.setBounds(new Rectangle(97, 31, 317, 123));
labmake.setFont(new java.awt.Font("幼圆", Font.BOLD, 15));
labmake.setText("X_X小制作");
labmake.setBounds(new Rectangle(156, 158, 158, 72));
this.add(labmake);
this.add(labcome);
}
}
-----------------------------------------------------------------文件分界线---------------------------------------------------------------------------------
package com.netbarview;
/**
* <p>Title:关于我们 </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2006</p>
*
* <p>Company: ACCP</p>
*
* @author xplu20000
* @version 1.0
*/
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.Rectangle;
import javax.swing.JLabel;
import java.awt.Font;
public class About extends JFrame {
public About() {
try {
jbInit();
} catch (Exception ex) {
ex.printStackTrace();
}
}
private void jbInit() throws Exception {
this.getContentPane().setLayout(null);
aboutpanel.setBounds(new Rectangle(9, 18, 287, 173));
aboutpanel.setLayout(null);
lalVerion.setFont(new java.awt.Font("宋体", Font.BOLD, 15));
lalCopyright.setFont(new java.awt.Font("宋体", Font.BOLD, 15));
lalData.setFont(new java.awt.Font("宋体", Font.BOLD, 15));
lalCopyright.setText("版权:");
lalCopyright.setBounds(new Rectangle(38, 49, 57, 38));
lalData.setText("X_X小组");
lalData.setBounds(new Rectangle(99, 46, 165, 44));
aboutpanel.add(lalVerion);
aboutpanel.add(lalCopyright);
aboutpanel.add(lalData);
this.getContentPane().add(aboutpanel);
lalVerion.setText("版本:1.0");
lalVerion.setBounds(new Rectangle(100, 8, 79, 48));
}
public JPanel aboutpanel = new JPanel();
public JLabel lalVerion = new JLabel();
public JLabel lalCopyright = new JLabel();
public JLabel lalData = new JLabel();
}
-----------------------------------------------------------------文件分界线---------------------------------------------------------------------------------
package com.intermedium;
/**
* <p>Title:卡实体类 </p>
*
* <p>Description: </p>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -