loginsystem.java~3~

来自「实现了一个简单的餐饮行业进销存系统」· JAVA~3~ 代码 · 共 65 行

JAVA~3~
65
字号
package com.csbook.restaurant;import java.awt.*;import javax.swing.*;public class LoginSystem extends JDialog {  JPanel northPanel = new JPanel();  JPanel centerPanel = new JPanel();  JPanel southPanel = new JPanel();  FlowLayout flowLayout1 = new FlowLayout();  FlowLayout flowLayout2 = new FlowLayout();  JLabel jLabel1 = new JLabel();  JLabel jLabel2 = new JLabel();  JLabel jLabel3 = new JLabel();  JTextField username = new JTextField();  JPasswordField password = new JPasswordField();  JButton login = new JButton();  public LoginSystem(Frame frame, String title, boolean modal) {    super(frame, title, modal);    try {      jbInit();      pack();    }    catch(Exception ex) {      ex.printStackTrace();    }  }  public LoginSystem() {    this(null, "", false);  }  private void jbInit() throws Exception {    northPanel.setLayout(flowLayout1);    centerPanel.setLayout(null);    southPanel.setLayout(flowLayout2);    jLabel1.setFont(new java.awt.Font("Dialog", 0, 16));    jLabel1.setText("请输入用户名和密码");    jLabel2.setFont(new java.awt.Font("Dialog", 0, 12));    jLabel2.setText("用户名");    jLabel2.setBounds(new Rectangle(17, 2, 83, 33));    jLabel3.setFont(new java.awt.Font("Dialog", 0, 12));    jLabel3.setText("密码");    jLabel3.setBounds(new Rectangle(18, 36, 45, 34));    username.setText("jTextField1");    username.setBounds(new Rectangle(63, 5, 189, 26));    password.setText("jPasswordField1");    password.setBounds(new Rectangle(63, 39, 189, 27));    login.setText("登陆系统");    this.getContentPane().setLayout(null);    southPanel.setBounds(new Rectangle(0, 123, 288, 42));    centerPanel.setBounds(new Rectangle(15, 40, 261, 69));    northPanel.setMinimumSize(new Dimension(109, 26));    northPanel.setBounds(new Rectangle(1, 1, 286, 31));    this.getContentPane().add(northPanel, null);    this.getContentPane().add(centerPanel, null);    this.getContentPane().add(southPanel, null);    southPanel.add(login, null);    northPanel.add(jLabel1, null);    centerPanel.add(username, null);    centerPanel.add(password, null);    centerPanel.add(jLabel3, null);    centerPanel.add(jLabel2, null);  }}

⌨️ 快捷键说明

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