java编写网络账号管理系统源码.docx
- 文档编号:6080722
- 上传时间:2023-01-03
- 格式:DOCX
- 页数:44
- 大小:903.45KB
java编写网络账号管理系统源码.docx
《java编写网络账号管理系统源码.docx》由会员分享,可在线阅读,更多相关《java编写网络账号管理系统源码.docx(44页珍藏版)》请在冰豆网上搜索。
java编写网络账号管理系统源码
网络账号管理系统
数据库名称:
T_user,T_source
T_user:
T_source:
界面设计
用户登录界面:
登录后显示界面:
修改密码界面:
按网站查询界面:
按账号查询界面:
修改界面:
添加账号界面:
账号添加成功:
删除界面:
源码:
packagecom.GUI.zzx;
importjava.awt.Toolkit;
importjava.awt.Dimension;
importjavax.swing.*;
//窗体居中类
publicclassWindowsCenter{
publicWindowsCenter(){
}
@SuppressWarnings("deprecation")
publicstaticvoidCenter(JFrameframe){
DimensionscreenSize=Toolkit.getDefaultToolkit().getScreenSize();
DimensionframeSize=frame.getSize();
if(frameSize.height>screenSize.height){
frameSize.height=screenSize.height;
}
if(frameSize.width>screenSize.width){
frameSize.width=screenSize.width;
}
frame.setLocation((screenSize.width-frameSize.width)/2,
(screenSize.height-frameSize.height)/2);
frame.show();
}
}
packagecom.GUI.zzx;
importh2.alterpass;
importjava.awt.Color;
importjava.awt.Font;
importjava.awt.Graphics;
importjava.awt.Image;
importjavax.swing.JFrame;
importjavax.swing.JPanel;
importjava.awt.BorderLayout;
importjavax.swing.BoxLayout;
importjavax.swing.JButton;
importjava.awt.event.ActionListener;
importjava.awt.event.ActionEvent;
importjava.awt.CardLayout;
importjavax.swing.JSplitPane;
importjavax.swing.BorderFactory;
importjavax.swing.Box;
importjavax.swing.ImageIcon;
importjavax.swing.JLabel;
importjavax.swing.JOptionPane;
importjavax.swing.JTable;
importjavax.swing.JTextField;
importjavax.swing.JPasswordField;
importjavax.swing.SwingConstants;
importjavax.swing.JScrollPane;
importUser.*;
importh2.AddResource;
@SuppressWarnings("serial")
publicclassWindowextendsJFrame{
privateJPanelpanelMain,panelFirst,panelAdd;
privateJButtonbtnMain,btnNet,btnAccount,btnAdd,btnExit;
privateCardLayoutcard,card1,card2;
privateJLabellbChange;
privateJTabletable1;
privateJTabletable2;
privateJTextFieldtextField;
privatestaticStringusertemp="";
/**
*Createtheapplication.
*/
publicWindow(){
initWin();
initListener();
}
/**
*InitiWinthecontentsoftheframe.
*/
///============================我是华丽的分割线(>^ω^<)喵=====窗口实现==========================================//
publicvoidinitWin(){
this.setTitle("网络账号管理系统");
this.setBounds(100,100,600,400);
this.setResizable(false);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanelpanel=newJPanel(newBorderLayout())
{
@Override
protectedvoidpaintComponent(Graphicsg){
ImageIconicon=newImageIcon(this.getClass().getResource("res/test.jpg"));
Imageimg=icon.getImage();
g.drawImage(img,0,0,icon.getIconWidth(),icon.getIconHeight(),icon.getImageObserver());
}
};
getContentPane().add(panel);
//=================我是华丽的分割线(>^ω^<)喵============标签栏=======================================
JPanelpanelBar=newJPanel(){
@Override
protectedvoidpaintComponent(Graphicsg){
ImageIconicon=newImageIcon(this.getClass().getResource("res/test.jpg"));
Imageimg=icon.getImage();
g.drawImage(img,0,0,icon.getIconWidth(),icon.getIconHeight(),icon.getImageObserver());
}
};
panel.add(panelBar,BorderLayout.NORTH);
panelBar.setLayout(newBoxLayout(panelBar,BoxLayout.X_AXIS));
//IconbtnMain_icon=newImageIcon("\btn_main.png");
btnMain=newJButton("首页");
btnMain.setContentAreaFilled(false);
btnMain.setForeground(Color.white);
//btnMain.setBorder(BorderFactory.createLineBorder(Color.blue,1));
btnMain.setFont(newFont("楷体",Font.BOLD|Font.ITALIC,14));
//btnMain.setSize(60,27);
panelBar.add(btnMain);
btnNet=newJButton("按网站查询");
btnNet.setContentAreaFilled(false);
btnNet.setForeground(Color.white);
btnNet.setEnabled(false);
panelBar.add(btnNet);
btnNet.setFont(newFont("楷体",Font.BOLD|Font.ITALIC,14));
btnAccount=newJButton("按账号查询");
btnAccount.setContentAreaFilled(false);
btnAccount.setForeground(Color.white);
btnAccount.setEnabled(false);
btnAccount.setFont(newFont("楷体",Font.BOLD|Font.ITALIC,14));
panelBar.add(btnAccount);
btnAdd=newJButton("添加账号");
btnAdd.setContentAreaFilled(false);
btnAdd.setEnabled(false);
btnAdd.setForeground(Color.white);
btnAdd.setFont(newFont("楷体",Font.BOLD|Font.ITALIC,14));
panelBar.add(btnAdd);
JLabellbSpace=newJLabel("");
panelBar.add(lbSpace);
btnExit=newJButton("注销");
btnExit.setContentAreaFilled(false);
btnExit.setEnabled(false);
btnExit.setForeground(Color.white);
btnExit.setFont(newFont("楷体",Font.BOLD|Font.ITALIC,14));
panelBar.add(btnExit);
//=========================我是华丽的分割线(>^ω^<)喵====主面板=====================================//
panelMain=newJPanel();
panel.add(panelMain,BorderLayout.CENTER);
card=newCardLayout();
panelMain.setLayout(card);
//=========================我是华丽的分割线(>^ω^<)喵====首页=====================================//
panelFirst=newJPanel();
card1=newCardLayout();
panelFirst.setLayout(card1);
finalJPanelLogin=newJPanel()
{
@Override
protectedvoidpaintComponent(Graphicsg){
ImageIconicon=newImageIcon(this.getClass().getResource("res/test.jpg"));
Imageimg=icon.getImage();
g.drawImage(img,0,0,icon.getIconWidth(),icon.getIconHeight(),icon.getImageObserver());
}
};
finalJPanelRegister=newJPanel()
{
@Override
protectedvoidpaintComponent(Graphicsg){
ImageIconicon=newImageIcon(this.getClass().getResource("res/test.jpg"));
Imageimg=icon.getImage();
g.drawImage(img,0,0,icon.getIconWidth(),icon.getIconHeight(),icon.getImageObserver());
}
};
finalJPanelpl3=newJPanel();
card2=newCardLayout();
///////////////////////////////////////登陆页////////////////////////////////////////////////////////////////////
Boxhbox1=Box.createHorizontalBox();
Boxhbox2=Box.createHorizontalBox();
Boxhbox3=Box.createHorizontalBox();
Boxhbox4=Box.createHorizontalBox();
Boxvbox1=Box.createVerticalBox();
JLabellbLogin=newJLabel("用户登录");
lbLogin.setFont(newFont("楷体",Font.BOLD,18));
lbLogin.setForeground(Color.red);
JLabellbUser=newJLabel("用户名");
lbUser.setFont(newFont("楷体",Font.BOLD,14));
JLabellbPwd=newJLabel("密码");
lbPwd.setFont(newFont("楷体",Font.BOLD,14));
finalJTextFieldtextUser=newJTextField(20);
finalJPasswordFieldtextPwd=newJPasswordField(20);
JButtonbtnLogin=newJButton("登录");
btnLogin.setFont(newFont("楷体",Font.BOLD,14));
btnLogin.addActionListener(newActionListener(){
@Override
publicvoidactionPerformed(ActionEventarg0){
//TODOAuto-generatedmethodstub
//获得输入的用户名和密码
Stringusername=textUser.getText();
charpass[]=textPwd.getPassword();
StringBuffersb=newStringBuffer();
for(inti=0;i sb.append(pass[i]); } Stringpassword=sb.toString(); //判断登陆 loginlog=newlogin(); if(log.log(username,password)){ usertemp=username; card1.show(panelFirst,"3"); textField.setText(usertemp); btnNet.setEnabled(true); btnAccount.setEnabled(true); btnAdd.setEnabled(true); btnExit.setEnabled(true); } } }); JButtonbtnReg=newJButton("注册"); btnReg.setFont(newFont("楷体",Font.BOLD,14)); btnReg.addActionListener(newActionListener(){ @Override publicvoidactionPerformed(ActionEvente){ //TODOAuto-generatedmethodstub card1.show(panelFirst,"2"); } }); hbox1.add(lbLogin); hbox2.add(lbUser); hbox2.add(textUser); hbox3.add(lbPwd); hbox3.add(textPwd); hbox4.add(btnLogin); hbox4.add(Box.createHorizontalStrut(20)); hbox4.add(btnReg); vbox1.add(Box.createVerticalStrut(30)); vbox1.add(hbox1); vbox1.add(Box.createVerticalStrut(20)); vbox1.add(hbox2); vbox1.add(Box.createVerticalStrut(20)); vbox1.add(hbox3); vbox1.add(Box.createVerticalStrut(20)); vbox1.add(hbox4); vbox1.add(Box.createVerticalStrut(30)); Login.add(vbox1); finalJPanelpr3=newJPanel(card2); JSplitPaneSetting=newJSplitPane(JSplitPane.HORIZONTAL_SPLIT,pl3,pr3); pl3.setLayout(null); JLabellabel=newJLabel("用户名"); label.setFont(newFont("楷体",Font.BOLD,12)); label.setBounds(5,50,50,25); pl3.add(label); textField=newJTextField(usertemp); textField.setEditable(false); textField.setBounds(45,50,100,25); pl3.add(textField); JLabellabel_2=newJLabel("当前用户"); label_2.setFont(newFont("楷体",Font.BOLD,14)); label_2.setBounds(40,10,70,30); pl3.add(label_2); JButtonbutton_1=newJButton("修改密码"); button_1.setFont(newFont("楷体",Font.BOLD,10)); button_1.setBounds(65,90,80,25); button_1.addActionListener(newActionListener(){ @Override publicvoidactionPerformed(ActionEvente){ //TODOAuto-generatedmethodstub card2.show(pr3,"1"); } }); pl3.add(button_1); Setting.setDividerLocation(150); Setting.setDividerSize (1); Setting.setResizeWeight (1); ////////////////////////////////////////////////////注册页面/////////////////////////////////////////////////////////////////// Boxhbox10=Box.createHorizontalBox(); Boxhbox20=Box.createHorizontalBox(); Boxhbox30=Box.createHorizontalBox(); Boxhbox40=Box.createHorizontalBox(); Boxhbox50=Box.createHorizontalBox(); Boxvbox20=Box.createVerticalBox(); JLabellbRegister=newJLabel("用户注册"); lbRegister.setFont(newFont("楷体",Font.BOLD,18)); //lbRegister.setForeground(newColor(180,50,200)); lbRegister.setForegroun
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- java 编写 网络 账号 管理 系统 源码