001: // @(#)PortWarning.java 1.5 "@(#)PortWarning.java 1.5 01/01/30 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 PortWarning extends Dialog {
009:
010: Label port;
011: // don't warn again
012: // Checkbox remember = new Checkbox(ResourceProperties.getString("pwd.6"));
013: Button ok, cancel;
014:
015: PortWarning(Frame f, ActionListener a, int p) {
016: super (f, ResourceProperties.getString("pwd.1")); // netlet connection attempt
017:
018: GridBagLayout gb = new GridBagLayout();
019: GridBagConstraints gc = new GridBagConstraints();
020:
021: setLayout(gb);
022:
023: gc.fill = GridBagConstraints.NONE;
024: gc.gridwidth = GridBagConstraints.REMAINDER;
025: gc.gridheight = 1;
026:
027: gc.gridx = 0;
028: gc.gridy = 0;
029: // a connection attempt is being made to port
030: Label label = new Label(ResourceProperties.getString("pwd.2"),
031: Label.CENTER);
032: gb.setConstraints(label, gc);
033: add(label);
034:
035: gc.gridx = 0;
036: gc.gridy = 1;
037: port = new Label((new Integer(p)).toString());
038: gb.setConstraints(port, gc);
039: add(port);
040:
041: gc.gridx = 0;
042: gc.gridy = 2;
043: // press OK to continue, cancel to stop
044: Label label2 = new Label(ResourceProperties.getString("pwd.3"),
045: Label.CENTER);
046: gb.setConstraints(label2, gc);
047: add(label2);
048:
049: gc.gridx = 0;
050: gc.gridy = 3;
051:
052: if (ClientConfig.showPortWarnCheckbox()) {
053: Panel pc = new Panel(new FlowLayout(FlowLayout.CENTER, 10,
054: 10));
055:
056: // pc.add(remember);
057: gb.setConstraints(pc, gc);
058: add(pc);
059:
060: gc.gridx = 0;
061: gc.gridy = 4;
062: }
063:
064: Panel b = new Panel(new FlowLayout(FlowLayout.CENTER, 10, 10));
065:
066: ok = new Button(ResourceProperties.getString("pwd.4")); // OK
067: ok.setActionCommand("OK");
068: ok.addActionListener(a);
069: b.add(ok);
070:
071: cancel = new Button(ResourceProperties.getString("pwd.5")); // Cancel
072: cancel.addActionListener(a);
073: b.add(cancel);
074: gb.setConstraints(b, gc);
075: add(b);
076:
077: pack();
078:
079: ok.requestFocus();
080:
081: Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
082: Point pt = new Point();
083: pt.x = (d.width / 6);
084: pt.y = (d.height / 6);
085: setLocation(pt);
086: }
087:
088: public void showWarning() {
089: setVisible(true);
090: toFront();
091: }
092:
093: synchronized public void waitForAction() {
094: try {
095: wait();
096: } catch (InterruptedException e) {
097: }
098: }
099:
100: synchronized public void notifyAction() {
101: notify();
102: }
103:
104: // public boolean getDontShow() {
105: // return remember != null ? remember.getState() : false;
106: // }
107: //
108: // public void setDontShow(boolean state) {
109: // if (remember != null)
110: // remember.setState(state);
111: // }
112: }
|