📄 frame1.java~49~
字号:
package untitled2;import java.awt.*;import java.awt.event.*;import javax.swing.*;import com.borland.jbcl.layout.*;/** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2006</p> * <p>Company: </p> * @author not attributable * @version 1.0 */public class Frame1 extends JFrame { JPanel contentPane; JTextField jTextField1 = new JTextField(); // JTextField password = new JTextField(); JPasswordField password=new JPasswordField(30); // password. JButton jButton1 = new JButton(); JButton jButton2 = new JButton(); JLabel jLabel1 = new JLabel(); JLabel jLabel2 = new JLabel(); JComboBox jComboBox1 = new JComboBox(); JLabel jLabel3 = new JLabel(); GridBagLayout gridBagLayout1 = new GridBagLayout(); //Construct the frame public Frame1() { enableEvents(AWTEvent.WINDOW_EVENT_MASK); try { jbInit(); jComboBox1.addItem("系统管理员"); jComboBox1.addItem("教务处人员"); jComboBox1.addItem("班主任"); jComboBox1.addItem("教师"); jComboBox1.addItem("学生"); } catch(Exception e) { e.printStackTrace(); } } //Component initialization private void jbInit() throws Exception { contentPane = (JPanel) this.getContentPane(); contentPane.setLayout(gridBagLayout1); this.setSize(new Dimension(300, 200)); this.setTitle("欢迎您进入数字化校园系统"); jButton1.setText("确定"); jButton1.addActionListener(new Frame1_jButton1_actionAdapter(this)); jButton2.setText("取消"); jLabel1.setFont(new java.awt.Font("Dialog", 0, 13)); jLabel1.setText("用户名"); jLabel2.setFont(new java.awt.Font("Dialog", 0, 13)); jLabel2.setText("密码"); jLabel3.setFont(new java.awt.Font("Dialog", 0, 13)); jLabel3.setText("身份"); jComboBox1.addActionListener(new Frame1_jComboBox1_actionAdapter(this)); password.setText(""); password.addActionListener(new Frame1_password_actionAdapter(this)); contentPane.setRequestFocusEnabled(true); contentPane.setToolTipText(""); contentPane.setVerifyInputWhenFocusTarget(true); jComboBox1.setEnabled(true); jComboBox1.setLocale(java.util.Locale.getDefault()); jComboBox1.setName(""); jComboBox1.setVisible(true); jComboBox1.setAlignmentX((float) 0.5); jComboBox1.setAutoscrolls(false); jComboBox1.setDebugGraphicsOptions(0); jComboBox1.setMinimumSize(new Dimension(27, 22)); jComboBox1.setOpaque(true); jComboBox1.setPreferredSize(new Dimension(27, 22)); jComboBox1.setRequestFocusEnabled(true); jComboBox1.setToolTipText("dignrigherong"); jComboBox1.setVerifyInputWhenFocusTarget(true); jComboBox1.setActionCommand("comboBoxChanged"); jComboBox1.setEditable(false); jComboBox1.setMaximumRowCount(8); jComboBox1.setPopupVisible(false); jComboBox1.setSelectedIndex(-1); contentPane.add(jLabel1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(31, 26, 0, 14), 11, 7)); contentPane.add(jLabel2, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(13, 32, 0, 0), 32, 4)); contentPane.add(jLabel3, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(17, 34, 71, 30), 0, 0)); contentPane.add(jComboBox1, new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0 ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(17, 10, 64, 0), 73, 4)); contentPane.add(password, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(13, 10, 0, 8), -94, 0)); contentPane.add(jButton2, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0 ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(13, 6, 0, 37), 0, 0)); contentPane.add(jButton1, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0 ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(31, 6, 0, 37), 0, 0)); contentPane.add(jTextField1, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(31, 10, 0, 8), 86, 0)); } //Overridden so we can exit when window is closed protected void processWindowEvent(WindowEvent e) { super.processWindowEvent(e); if (e.getID() == WindowEvent.WINDOW_CLOSING) { System.exit(0); } } void jComboBox1_actionPerformed(ActionEvent e) {//case() } void jButton1_actionPerformed(ActionEvent e) {//switch(jComboBox1.s. //if (jComboBox1=="老师") // Frame2 frame= new Frame2(); // frame.show(); // frame. // jiaoWu frame=new jiaoWu(); // frame.show(); } } void password_actionPerformed(ActionEvent e) { // }}class Frame1_jComboBox1_actionAdapter implements java.awt.event.ActionListener { Frame1 adaptee; Frame1_jComboBox1_actionAdapter(Frame1 adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.jComboBox1_actionPerformed(e); }}class Frame1_jButton1_actionAdapter implements java.awt.event.ActionListener { Frame1 adaptee; Frame1_jButton1_actionAdapter(Frame1 adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.jButton1_actionPerformed(e); }}class Frame1_password_actionAdapter implements java.awt.event.ActionListener { Frame1 adaptee; Frame1_password_actionAdapter(Frame1 adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.password_actionPerformed(e); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -