01: package com.sun.portal.netlet.client.common;
02:
03: import javax.swing.*;
04: import java.awt.*;
05: import java.awt.event.ActionEvent;
06: import java.awt.event.ActionListener;
07:
08: public class ProxyInfoHelpDialog extends JDialog implements
09: ActionListener {
10:
11: private JPanel mainPanel;
12: private GridBagConstraints gc;
13: private JTextArea help;
14: private JButton ok;
15:
16: public ProxyInfoHelpDialog(Frame parent) {
17: super (parent, ResourceProperties.getString("pihd.1"));
18: setResizable(false);
19:
20: /* Initialize all components */
21: mainPanel = new JPanel();
22: gc = new GridBagConstraints();
23: help = new JTextArea(ResourceProperties.getString("pihd.3"), 8,
24: 40);
25: help.setEditable(false);
26: /* Set default state and arrange the components */
27: getContentPane().setLayout(new java.awt.GridBagLayout());
28: mainPanel.setLayout(new java.awt.GridBagLayout());
29: mainPanel.setBorder(new javax.swing.border.TitledBorder(
30: ResourceProperties.getString("pihd.2")));
31:
32: gc.anchor = gc.NORTHWEST;
33: gc.gridx = 0;
34: gc.gridy = 0;
35: mainPanel.add(help, gc);
36:
37: gc.gridx = 0;
38: gc.gridy = 1;
39: gc.anchor = GridBagConstraints.CENTER;
40: gc.fill = gc.NONE;
41: gc.insets = new Insets(10, 0, 0, 10);
42: gc.ipadx = 30;
43: ok = new JButton("ok");
44: ok.setActionCommand("OK");
45: ok.addActionListener(this );
46: mainPanel.add(ok, gc);
47:
48: gc.anchor = gc.NORTHWEST;
49: gc.gridx = 0;
50: gc.gridy = 0;
51: gc.weightx = 1;
52: gc.weighty = 1;
53: gc.gridheight = 5;
54: gc.gridwidth = 1;
55: gc.insets = new Insets(5, 0, 0, 0);
56: getContentPane().add(mainPanel, gc);
57:
58: pack();
59: ok.requestFocus();
60:
61: Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
62: Point pt = new Point();
63: pt.x = (d.width / 4);
64: pt.y = (d.height / 4);
65: setLocation(pt);
66:
67: }
68:
69: public void actionPerformed(ActionEvent evt) {
70: Object obj = evt.getSource();
71: if (obj == this .ok) {
72: this .setVisible(false);
73: }
74: }
75: }
|