Java写图书管理系统(三、用户功能页面)

上篇介绍了注册页面,下面我们就要进入正题了---------功能页面

我将功能页面分为:用户功能页面 and 管理员功能页面

ps:使用者是用户还是管理员无需区别登录,直接由系统根据登录账户判定~~~~~~~~~

下面先来看用户功能页面吧:

主页面长这样,每个按钮功能均已实现,标题为当前用户名~~~~~~~

image

查看个人资料:

image

修改本人资料:

image

修改后的资料:

image

查看由管理员上传的图书库:

image

代码实现:

package Library;

import java.awt.Frame;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JOptionPane;

/**
 * 用户功能选项
 * @author hwt1070359898
 *
 */
public class UserFunction extends Frame implements ActionListener{
    //定义各个控件
    private JButton btLookSelf=new JButton("查看个人资料");
    private JButton btModify=new JButton("修改个人资料");
    private JButton btLookBooks=new JButton("查看书库信息");
    private JButton btExit=new JButton("退出系统");

    public UserFunction(){

        super("用户:"+User.num);//串口标题
        this.setLayout(null);//设置为手工设置各个组件的位置和大小

        btLookSelf.setBounds(new Rectangle(50,80,300,50));//修改个人资料
        btModify.setBounds(new Rectangle(50,150,300,50));//修改个人资料
        btLookBooks.setBounds(new Rectangle(50,220,300,50));//查看书库信息
        btExit.setBounds(new Rectangle(50,290,300,50));//退出系统

        btLookSelf.addActionListener(this);
        btModify.addActionListener(this);
        btLookBooks.addActionListener(this);
        btExit.addActionListener(this);

        this.add(btLookSelf);
        this.add(btModify);
        this.add(btLookBooks);
        this.add(btExit);

        this.setSize(400,370);

        GUIUtil.toCenter(this);//使窗口居中
        this.setVisible(true);//可视化
        this.setResizable(false);//关闭放大窗口
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//设置错误关闭操作

        //用于关闭窗体事件
        this.addWindowListener(new WindowAdapter(){
            public void windowClosing(WindowEvent e){
                dispose();
            }
        });
    }

    private void setDefaultCloseOperation(int exitOnClose) {
        // TODO Auto-generated method stub

    }

    @Override
    public void actionPerformed(ActionEvent e) {
        // TODO Auto-generated method stub
        if(e.getSource()==btLookSelf) {
            String message="您的详细资料为:\n";

            message+="学号:"+User.num+"\n";
            message+="姓名:"+User.name+"\n";
            message+="用户名:"+User.username+"\n";
            message+="性别:"+User.sex+"\n";
            message+="年龄:"+User.age+"\n";
            message+="班级:"+User.clas+"\n";

            JOptionPane.showMessageDialog(this,message);
        }else if(e.getSource()==btModify) {
            new ModifyDialog("固定学号:"+User.num);
            this.dispose();
        }
        else if(e.getSource()==btLookBooks) {
           this.dispose();
            new ShowBook(); 
        }
        else if(e.getSource()==btExit){
            JOptionPane.showMessageDialog(this,"谢谢光临,欢迎下次继续使用本系统!");
            System.exit(0);
        }
    }
}

用户功能就是如此,下篇看管理员功能`````````````````

文章中有任何不懂的问题,欢迎大家骚扰,博主很愿意和大家共同进步哟,整理不易,喜欢的话就打赏一下吧~~~

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 项目名称: 保险指挥调度系统,缩写IDAS。 软件功能: 本软件由6个功能模块组成: 1) 报案受理 2) 指挥调...
    威客方案阅读 5,285评论 0 2
  • 点击查看原文 Web SDK 开发手册 SDK 概述 网易云信 SDK 为 Web 应用提供一个完善的 IM 系统...
    layjoy阅读 14,731评论 0 15
  • Swift1> Swift和OC的区别1.1> Swift没有地址/指针的概念1.2> 泛型1.3> 类型严谨 对...
    cosWriter阅读 13,793评论 1 32
  • 清晨5点,还在梦乡的我被毛茸茸爪子撩醒,那个小毛孩看到我睁开眼,立马兴奋不已。简单洗漱,就带着维尼出门了,天不...
    锦墨hhy阅读 2,905评论 0 0
  • 生:马可波罗 师:你知道其他有关于他的事情吗? 生:写了《马可波罗行记》 师:这本书曾被誉为世界第一奇书 生:蒙古...
    vivia93阅读 3,940评论 0 0