📄 keyupdate.java
字号:
/* ---------------------------------------------------------------------- The SINUS Firewall -- a TCP/IP packet filter for Linux Written within the SINUS project at the University of Zurich, SWITCH, Telekurs Payserv AG, ETH Zurich. originally based on the sf Firewall Software (C) 1996 by Robert Muchsel and Roland Schmid. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. SINUS Firewall resources: SINUS Homepage: http://www.ifi.unizh.ch/ikm/SINUS/ Firewall Homepage: http://www.ifi.unizh.ch/ikm/SINUS/firewall.html Frequently asked questions: http://www.ifi.unizh.ch/ikm/SINUS/sf_faq.html Mailing list for comments, questions, bug reports: firewall@ifi.unizh.ch ---------------------------------------------------------------------- */package sfclasses;import java.awt.*;import java.awt.event.*;import java.util.*;import java.io.*;import java.security.*;public class Keyupdate extends Dialog implements ActionListener { /** * Display dialog to enter new password for a login. * @param parent Parent frame * @param hostname Hostname on which to change password * @see Authentication */ public Keyupdate(Frame parent, String hostname) { super(parent, "Enter new password", true); // create Keyupdate Dialog this.parent = parent; setResizable(true); setLayout(new GridLayout(6,1)); setSize(400, 300); password = new TextField(20); status = new Label(); Button okButton = new Button("OK"); okButton.addActionListener(this); Button cancelButton = new Button("Cancel"); cancelButton.addActionListener(this); Panel p1 = new Panel(); Font title = new Font("Helvetica", Font.BOLD, 12); p1.setFont(title); p1.add(new Label("Enter new password on host "+ hostname)); Panel p2 = new Panel(); p2.add(new Label("Password:")); p2.add(password); Panel p3 = new Panel(); status.setText("Press OK to proceed."); p3.add(status); Panel p4 = new Panel(); p4.add(okButton); p4.add(cancelButton); add(p1); add(p2); add(p3); add(p4); setVisible(true); } /** * Actionlistener */ public void actionPerformed(ActionEvent ae) { String what = ae.getActionCommand(); if (what == "Cancel") { dispose(); return; } if (what == "OK") { key = Authentication.calcKey(password.getText(), "100"); if (key.length() == 0) System.out.println("Error calcKey"); dispose(); return; } } /** * Get the calculated key * @return String representing the key */ public String getKey() { return key; } // private data private Frame parent; private String key; // generated key to be returned private TextField password; private Label status;} // class Keyupdate
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -