001: // @(#)ProxyAuthDialog.java 1.2 "@(#)ProxyAuthDialog.java 1.2 00/02/09 Sun Microsystems"
002:
003: package com.sun.portal.netlet.client.common;
004:
005: import java.awt.*;
006: import java.awt.event.ActionListener;
007:
008: public class ReauthDialog extends Dialog {
009:
010: Label port;
011: TextField passfield;
012: Button ok, cancel;
013:
014: ReauthDialog(Frame f, ActionListener a, int p) {
015: super (f, ResourceProperties.getString("reauth.1")); //Netlet Authentication
016:
017: GridBagLayout gb = new GridBagLayout();
018: GridBagConstraints gc = new GridBagConstraints();
019: setLayout(gb);
020:
021: gc.anchor = gc.CENTER;
022: gc.gridx = 0;
023: gc.gridy = 0;
024: gc.insets = new Insets(10, 0, 0, 0);
025: gc.gridheight = 1;
026:
027: Label label = new Label(ResourceProperties
028: .getString("reauth.2")
029: + " " + (new Integer(p)).toString(), Label.CENTER);
030: gb.setConstraints(label, gc);
031: add(label);
032:
033: Panel up = new Panel(new GridBagLayout());
034: gc.gridx = 0;
035: gc.gridy = 0;
036: gc.insets = new Insets(0, 10, 0, 0);
037: Label nlabel = new Label(ResourceProperties
038: .getString("reauth.3")); // Password
039: up.add(nlabel, gc);
040: passfield = new TextField(20);
041: passfield.setEchoChar('*');
042: gc.gridx = 1;
043: gc.insets = new Insets(0, 0, 0, 10);
044: up.add(passfield, gc);
045: gc.gridx = 0;
046: gc.gridy = 1;
047: gc.insets = new Insets(5, 0, 0, 0);
048: gb.setConstraints(up, gc);
049: add(up);
050:
051: Panel b = new Panel(new GridBagLayout());
052: gc.gridx = 0;
053: gc.gridy = 0;
054: gc.ipadx = 30;
055: gc.insets = new Insets(10, 0, 10, 5);
056: ok = new Button(ResourceProperties.getString("reauth.4")); // OK
057: ok.setActionCommand("OK");
058: ok.addActionListener(a);
059: b.add(ok, gc);
060:
061: cancel = new Button(ResourceProperties.getString("reauth.5")); // Cancel
062: cancel.addActionListener(a);
063: cancel.setActionCommand("Cancel");
064: gc.gridx = 1;
065: gc.ipadx = 5;
066: gc.insets = new Insets(10, 0, 10, 0);
067: b.add(cancel, gc);
068:
069: gc.gridx = 0;
070: gc.gridy = 2;
071: gc.ipadx = 0;
072: gc.insets = new Insets(0, 0, 0, 0);
073: gb.setConstraints(b, gc);
074: add(b);
075:
076: pack();
077:
078: Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
079: Point pt = new Point();
080: pt.x = (d.width / 6);
081: pt.y = (d.height / 6);
082: setLocation(pt);
083: }
084:
085: public void showWarning() {
086: setVisible(true);
087: passfield.setText("");
088: passfield.requestFocus();
089: toFront();
090: }
091:
092: synchronized public void waitForAction() {
093: try {
094: wait();
095: } catch (InterruptedException e) {
096: }
097: }
098:
099: synchronized public void notifyAction() {
100: notify();
101: }
102:
103: public String getPassword() {
104: return (passfield.getText());
105: }
106: }
|