⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 selectlogin.java~76~

📁 银行管理系统,根据实习的要求以及参考现实中的银行数据库系统
💻 JAVA~76~
字号:
package bank;
import javax.swing.JFrame;
import javax.swing.JRadioButton;
import com.borland.jbcl.layout.XYLayout;
import com.borland.jbcl.layout.*;
import javax.swing.JLabel;
import java.awt.Font;
import java.awt.Color;
import javax.swing.JButton;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JOptionPane;
import java.awt.Toolkit;
import java.awt.Dimension;
import javax.swing.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.SystemColor;

//选择进入界面类
public class SelectLogin extends JFrame
{
  public SelectLogin() {
    try {
      jbInit();
    }
    catch (Exception ex) {
      ex.printStackTrace();
    }

    addWindowListener(new WindowAdapter(){
      public void windowClosing(WindowEvent e){
        System.exit(0);
      }

    }

        );
  }

  private void jbInit() throws Exception {
    jRadioButton1.setBackground(Color.pink);
    jRadioButton1.setFont(new java.awt.Font("宋体", Font.PLAIN, 16));
    jRadioButton1.setText("管理员");
    jButton1.updateUI();
    this.getContentPane().setLayout(xYLayout1);
   jButton1.addActionListener(new SelectLogin_jButton1_actionAdapter(this));
    this.getContentPane().setBackground(new Color(176, 219, 219));
    this.setForeground(SystemColor.inactiveCaption);
    jButton1.setBackground(new Color(176, 219, 219));
    jButton1.setForeground(SystemColor.controlHighlight);
    jButton1.setSelected(true);
    grounp.add(jRadioButton1);
    grounp.add(jRadioButton2);
    this.getContentPane().add(jLabel1, new XYConstraints(19, 23, -1, -1));
    this.getContentPane().add(jRadioButton2,
                              new XYConstraints(132, 146, 107, 33));
    this.getContentPane().add(jRadioButton1, new XYConstraints(134, 84, 106, 32));
    this.getContentPane().add(jButton1, new XYConstraints(92, 229, 84, 39));
    this.getContentPane().add(jButton2, new XYConstraints(243, 230, 86, 39));
    jLabel1.setFont(new java.awt.Font("宋体", Font.PLAIN, 18));
    jLabel1.setForeground(Color.red);
    jLabel1.setText("请选择进入模式:");
    jRadioButton2.setBackground(Color.pink);
    jButton2.setBackground(new Color(176, 219, 219));
    jButton2.setFont(new java.awt.Font("Dialog", Font.PLAIN, 12));
    jButton2.addActionListener(new SelectLogin_jButton2_actionAdapter(this));
    jButton1.setFont(new java.awt.Font("Dialog", Font.PLAIN, 12));
    jRadioButton2.setFont(new java.awt.Font("宋体", Font.PLAIN, 16));
    jRadioButton2.setText("用户");
  }

  ButtonGroup grounp=new ButtonGroup();
  JRadioButton jRadioButton1 = new JRadioButton();
  JRadioButton jRadioButton2 = new JRadioButton();
  JLabel jLabel1 = new JLabel();
  JButton jButton1 = new JButton(new ImageIcon("d.gif"));
  JButton jButton2 = new JButton(new ImageIcon("df.gif"));
  XYLayout xYLayout1 = new XYLayout();
  public void jButton1_actionPerformed(ActionEvent e) {
    if((e.getSource()==jButton1)&&(jRadioButton2.isSelected()==true))//用户界面
    {

    UserLogFrame userframe=new UserLogFrame();
     this.dispose();//关闭之前的窗口
     Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
     Dimension frameSize = userframe.getSize();
   //  WindowFrameP win=new WindowFrameP();
   // DisplayMode dis=new DisplayMode(1024,768,32,86);
  //  win.setFullScreen(dis,userframe);
    userframe.setState(userframe.NORMAL);
    userframe.setLocation( (screenSize.width - frameSize.width) / 2,(screenSize.height - frameSize.height) / 2);
    userframe.show();//显示在屏幕


     }
    else if((e.getSource()==jButton1)&&(jRadioButton1.isSelected()==true))//管理员界面
    {
      AdminFrame admin=new AdminFrame();
      this.dispose();
      Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
      Dimension frameSize = admin.getSize();
      admin.setState(admin.NORMAL);
      admin.setLocation( (screenSize.width - frameSize.width) / 2,(screenSize.height - frameSize.height) / 2);
      admin.show();

     }
    else //弹出一个对话框叫你选择
    {


      JOptionPane.showMessageDialog( null,"请选择其中一项,要么退出银行系统!!");

    }
  }

  public void jButton2_actionPerformed(ActionEvent e) {
    System.exit(0);
  }

}

class SelectLogin_jButton2_actionAdapter
    implements ActionListener {
  private SelectLogin adaptee;
  SelectLogin_jButton2_actionAdapter(SelectLogin adaptee) {
    this.adaptee = adaptee;
  }

  public void actionPerformed(ActionEvent e) {
    adaptee.jButton2_actionPerformed(e);
  }
}

class SelectLogin_jButton1_actionAdapter
    implements ActionListener {
  private SelectLogin adaptee;
  SelectLogin_jButton1_actionAdapter(SelectLogin adaptee) {
    this.adaptee = adaptee;
  }

  public void actionPerformed(ActionEvent e) {
    adaptee.jButton1_actionPerformed(e);
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -