图书管理系统登录界面 编码

  • 格式:doc
  • 大小:50.00 KB
  • 文档页数:5

package B;import java.awt.Color;import java.awt.Font;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.ImageIcon;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JPasswordField;import javax.swing.JTextField;public class C extends JFrame{static C d;JButton jb1,jb2,jb3;C(){this.setTitle("登陆");this.setSize(600,400);this.setLocation(600, 400);JLabel jl=new JLabel(new ImageIcon("g://6.jpg"));//添加背景Font f=new Font("Serif",Font.BOLD,14);//设置字体JTextField jt=new JTextField();JPasswordField jp=new JPasswordField();this.setLayout(null);jb1=new JButton("登陆");jb1.addActionListener(new MyListener()); //添加监听jb1.setBackground(Color.gray);//设置背景颜色jb2=new JButton("注册");jb2.setBackground(Color.gray);jt.setBounds(90, 150, 90, 20);jp.setBounds(90, 190, 90, 20);jb1.setBounds(50, 250, 60, 20);jb2.setBounds(120, 250, 60, 20);this.add(jt);this.add(jp);this.add(jb1);this.add(jb2);this.setLayout(null);jl.setBounds(0,0,600,400);//设置背景大小this.add(jl);}class MyListener implements ActionListener{public void actionPerformed(ActionEvent arg0) {d.dispose();new jiemian();}}public static void main(String[] args) {d=new C();d.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);d.setVisible(true);}}package B;import java.awt.FlowLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.ImageIcon;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;public class jiemian extends JFrame {JButton jb1,jb2,jb3,jb4,jb5,jb6;static jiemian o;jiemian(){this.setVisible(true);this.setTitle("图书馆管理系统");this.setSize(600,400);this.setLocation(300,200);JLabel jl=new JLabel(new ImageIcon("g://2.jpg"));//添加背景jb1=new JButton("图书采购");jb2=new JButton("图书入库");jb3=new JButton("图书流通");jb4=new JButton("读者管理");jb5=new JButton("统计查询");jb6=new JButton("系统设置");this.add(jb1);this.add(jb2);this.add(jb3);this.add(jb4);this.add(jb5);this.add(jb6);this.setLayout(null);jl.setBounds(0,0,600,400);//设置背景大小this.add(jl);this.setLayout(new FlowLayout());jb1.addActionListener(new MyListener1());jb2.addActionListener(new MyListener2());jb3.addActionListener(new MyListener3());jb4.addActionListener(new MyListener4());jb5.addActionListener(new MyListener5());jb6.addActionListener(new MyListener6());this.setVisible(true);}class MyListener1 implements ActionListener{public void actionPerformed(ActionEvent e) { if(e.getSource()==jb1){new jiemian1();o.dispose();}}}class MyListener2 implements ActionListener{public void actionPerformed(ActionEvent e) { if(e.getSource()==jb2){new jiemian2();o.dispose();}}}class MyListener3 implements ActionListener{public void actionPerformed(ActionEvent e) { if(e.getSource()==jb3){new jiemian3();o.dispose();}}}class MyListener4 implements ActionListener{public void actionPerformed(ActionEvent e) { if(e.getSource()==jb4){new jiemian4();o.dispose();}}}class MyListener5 implements ActionListener{public void actionPerformed(ActionEvent e) { if(e.getSource()==jb5){new jiemian5();o.dispose();}}}class MyListener6 implements ActionListener{public void actionPerformed(ActionEvent e) {if(e.getSource()==jb6){new jiemian6();o.dispose();}}}public static void main(String[] args) {o=new jiemian();o.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);o.setVisible(true);}}package B;import java.awt.FlowLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.ImageIcon;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;public class jiemian1 extends JFrame {JButton jb3;static jiemian1 o;jiemian1(){this.setVisible(true);this.setTitle("图书采购");this.setSize(600,400);this.setLocation(300,200);JLabel jl=new JLabel(new ImageIcon("g://2.jpg"));//添加背景JButton jb1=new JButton("订单查询");JButton jb2=new JButton("新书通报");jb3=new JButton("返回");this.add(jb1);this.add(jb2);this.add(jb3);this.setLayout(null);jl.setBounds(0,0,600,400);//设置背景大小this.add(jl);this.setLayout(new FlowLayout());this.setVisible(true);jb3.addActionListener(new MyListener3()); }class MyListener3 implements ActionListener{public void actionPerformed(ActionEvent e) {if(e.getSource()==jb3){new jiemian();o.dispose();}}}public static void main(String[] args) {o=new jiemian1();o.setVisible(true);}}。