?? word.java
字號:
package pass;import java.awt.*;import java.awt.event.*;import java.applet.*;import com.borland.jbcl.layout.*;import javax.swing.*;public class word extends Applet { boolean isStandalone = false; XYLayout xYLayout1 = new XYLayout(); JPasswordField pass = new JPasswordField(); JTextField name = new JTextField(); JLabel l1 = new JLabel(); JLabel l2 = new JLabel(); JButton b1 = new JButton(); Label label1 = new Label(); /**Get a parameter value*/ public String getParameter(String key, String def) { return isStandalone ? System.getProperty(key, def) : (getParameter(key) != null ? getParameter(key) : def); } /**Construct the applet*/ public word() { } /**Initialize the applet*/ public void init() { try { jbInit(); } catch(Exception e) { e.printStackTrace(); } } /**Component initialization*/ private void jbInit() throws Exception { pass.setFont(new java.awt.Font("Dialog", 0, 16)); pass.setToolTipText(""); this.setLayout(xYLayout1); name.setFont(new java.awt.Font("SansSerif", 0, 16)); l1.setFont(new java.awt.Font("Dialog", 0, 16)); l1.setText("姓名"); l2.setFont(new java.awt.Font("Dialog", 0, 16)); l2.setText("密碼"); b1.setFont(new java.awt.Font("Dialog", 0, 16)); b1.setText("確定"); b1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { b1_actionPerformed(e); } }); label1.setFont(new java.awt.Font("Dialog", 0, 20)); label1.setForeground(Color.red); this.add(name, new XYConstraints(120, 70, 109, 34)); this.add(pass, new XYConstraints(120, 109, 109, 34)); this.add(l1, new XYConstraints(67, 70, 72, 31)); this.add(l2, new XYConstraints(67, 109, 76, 30)); this.add(b1, new XYConstraints(158, 165, 71, 31)); this.add(label1, new XYConstraints(86, 220, 191, 39)); } /**Get Applet information*/ public String getAppletInfo() { return "Applet Information"; } /**Get parameter info*/ public String[][] getParameterInfo() { return null; } void b1_actionPerformed(ActionEvent e) { if( (name.getText()).equals("j") &&String.valueOf((pass.getPassword())).equals("j") ){ name.setText(""); pass.setText(""); label1.setText("密碼驗證正確!"); } else label1.setText("密碼驗證有誤!"); }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -