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

📄 frame1.java

📁 可以告诉你怎么输入密码的程序
💻 JAVA
字号:
package mima;import java.awt.*;import java.awt.event.*;import javax.swing.*;import com.borland.jbcl.layout.*;import java.io.*;import java.lang.*;/** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2004</p> * <p>Company: </p> * @author not attributable * @version 1.0 */public class Frame1 extends JFrame {  JPanel contentPane;  XYLayout xYLayout1 = new XYLayout();  JLabel jLabel1 = new JLabel();  JLabel jLabel2 = new JLabel();  JPasswordField jP1 = new JPasswordField();  JPasswordField jP2 = new JPasswordField();  JButton jButton1 = new JButton();  JButton jButton2 = new JButton();  JButton jButton3 = new JButton();  JButton jButton4 = new JButton();  JButton jButton5 = new JButton();  //Construct the frame  public Frame1() {    enableEvents(AWTEvent.WINDOW_EVENT_MASK);    try {      jbInit();    }    catch(Exception e) {      e.printStackTrace();    }  }  //Component initialization  private void jbInit() throws Exception  {    contentPane = (JPanel) this.getContentPane();    jLabel1.setText("请输入您的密码:");    contentPane.setLayout(xYLayout1);    this.setSize(new Dimension(400, 300));    this.setTitle("Frame Title");    contentPane.setToolTipText("");    jLabel2.setText("请再次输入密码:");    jButton1.setText("确定");    jButton1.addActionListener(new Frame1_jButton1_actionAdapter(this));    jButton2.setText("重输");    jButton2.addActionListener(new Frame1_jButton2_actionAdapter(this));    jButton3.setText("jButton3");    jButton3.addActionListener(new Frame1_jButton3_actionAdapter(this));    jButton4.setText("jButton4");    jP1.setText("");    jP2.setText("");    jButton5.setText("jButton5");    jButton5.addActionListener(new Frame1_jButton5_actionAdapter(this));    contentPane.add(jLabel1, new XYConstraints(35, 15, -1, -1));    contentPane.add(jLabel2, new XYConstraints(36, 69, -1, -1));    contentPane.add(jP1,    new XYConstraints(133, 10, 112, -1));    contentPane.add(jP2,  new XYConstraints(133, 70, 113, -1));    contentPane.add(jButton1,   new XYConstraints(293, 12, -1, -1));    contentPane.add(jButton2,   new XYConstraints(296, 66, -1, -1));    contentPane.add(jButton3,   new XYConstraints(72, 159, -1, -1));    contentPane.add(jButton5,   new XYConstraints(156, 211, -1, -1));    contentPane.add(jButton4, new XYConstraints(244, 165, -1, -1));  }  //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 jButton1_actionPerformed(ActionEvent e) {   if(String.valueOf(jP1.getPassword()).equals(String.valueOf(jP2.getPassword())))     jButton1.setText("pass");    else      jButton1.setText("no pass");  }  void jButton2_actionPerformed(ActionEvent e) {     jP1.setText("");     jP2.setText("");  }  void jButton3_actionPerformed(ActionEvent e) {     try{ String comm="C:\\Program Files\\Internet Explorer\\iexplore.exe";          Process chi=Runtime.getRuntime().exec(comm);     }     catch(IOException ex){}  }  void jButton5_actionPerformed(ActionEvent e) {     System.exit(0);  }}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_jButton2_actionAdapter implements java.awt.event.ActionListener {  Frame1 adaptee;  Frame1_jButton2_actionAdapter(Frame1 adaptee) {    this.adaptee = adaptee;  }  public void actionPerformed(ActionEvent e) {    adaptee.jButton2_actionPerformed(e);  }}class Frame1_jButton3_actionAdapter implements java.awt.event.ActionListener {  Frame1 adaptee;  Frame1_jButton3_actionAdapter(Frame1 adaptee) {    this.adaptee = adaptee;  }  public void actionPerformed(ActionEvent e) {    adaptee.jButton3_actionPerformed(e);  }}class Frame1_jButton5_actionAdapter implements java.awt.event.ActionListener {  Frame1 adaptee;  Frame1_jButton5_actionAdapter(Frame1 adaptee) {    this.adaptee = adaptee;  }  public void actionPerformed(ActionEvent e) {    adaptee.jButton5_actionPerformed(e);  }}

⌨️ 快捷键说明

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