001: // AboutJigAdmin.java
002: // $Id: AboutJigAdmin.java,v 1.4 2000/08/16 21:37:31 ylafon Exp $
003: // (c) COPYRIGHT MIT, INRIA and Keio, 1999.
004: // Please first read the full copyright statement in file COPYRIGHT.html
005:
006: package org.w3c.jigadmin.gui;
007:
008: import java.awt.Component;
009: import java.awt.Color;
010: import java.awt.Container;
011: import java.awt.BorderLayout;
012: import java.awt.FlowLayout;
013: import java.awt.Frame;
014: import java.awt.event.ActionListener;
015: import java.awt.event.ActionEvent;
016: import java.awt.event.MouseEvent;
017: import java.awt.event.MouseAdapter;
018:
019: import javax.swing.BoxLayout;
020: import javax.swing.BorderFactory;
021: import javax.swing.JButton;
022: import javax.swing.JOptionPane;
023: import javax.swing.JPanel;
024: import javax.swing.JLabel;
025:
026: import org.w3c.jigadmin.widgets.Icons;
027: import org.w3c.jigadmin.widgets.ClosableDialog;
028:
029: import org.w3c.tools.widgets.Utilities;
030:
031: /**
032: * The About Jigadmin dialog.
033: * @version $Revision: 1.4 $
034: * @author Benoît Mahé (bmahe@w3.org)
035: */
036: public class AboutJigAdmin extends ClosableDialog {
037:
038: private JLabel teamlabel = null;
039:
040: private AboutJigAdmin(Frame frame, String title, boolean modal) {
041: super (frame, title, modal);
042: build();
043: }
044:
045: private JLabel getLabel(String label) {
046: JLabel lbl = new JLabel(label, JLabel.CENTER);
047: lbl.setForeground(Color.black);
048: lbl.setFont(Utilities.boldFont);
049: return lbl;
050: }
051:
052: /**
053: * The dialog is about to be closed.
054: */
055: protected void close() {
056: setVisible(false);
057: dispose();
058: }
059:
060: /**
061: * Build the interface.
062: */
063: protected void build() {
064: Container cont = getContentPane();
065: cont.setLayout(new BorderLayout());
066:
067: JLabel w3clabel = new JLabel(Icons.w3chIcon);
068: JLabel jiglabel = new JLabel(Icons.jigsawIcon);
069: teamlabel = new JLabel(Icons.serverIcon);
070: teamlabel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10,
071: 10));
072:
073: JLabel label1 = getLabel("JigAdmin, The Jigsaw Administration tool");
074: JLabel label2 = getLabel("Version 2.0");
075: JLabel label3 = getLabel("A program by the Jigsaw Team (W3C)");
076: JLabel label4 = getLabel("http://www.w3.org/Jigsaw/");
077: JLabel label5 = getLabel("(c) COPYRIGHT MIT, INRIA and Keio, 1999.");
078:
079: teamlabel.addMouseListener(new MouseAdapter() {
080: public void mouseEntered(MouseEvent e) {
081: teamlabel.setIcon(Icons.teamIcon);
082: }
083:
084: public void mouseExited(MouseEvent e) {
085: teamlabel.setIcon(Icons.serverIcon);
086: }
087: });
088:
089: JButton okb = new JButton("OK");
090: okb.setFont(Utilities.boldFont);
091: okb.addActionListener(new ActionListener() {
092: public void actionPerformed(ActionEvent e) {
093: close();
094: }
095: });
096:
097: JPanel p1 = new JPanel(new FlowLayout());
098: p1.add(w3clabel);
099: p1.add(jiglabel);
100:
101: JPanel p2 = new JPanel();
102: p2.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
103: p2.setLayout(new BoxLayout(p2, BoxLayout.Y_AXIS));
104: p2.add(label1);
105: p2.add(label2);
106: p2.add(label3);
107: p2.add(label4);
108: p2.add(label5);
109:
110: JPanel p3 = new JPanel(new BorderLayout());
111: p3.add(teamlabel, BorderLayout.WEST);
112: p3.add(p2, BorderLayout.CENTER);
113:
114: JPanel p4 = new JPanel();
115: p4.add(okb);
116:
117: cont.add(p1, BorderLayout.NORTH);
118: cont.add(p3, BorderLayout.CENTER);
119: cont.add(p4, BorderLayout.SOUTH);
120: pack();
121: }
122:
123: /**
124: * Show the About Jigadmin dialog.
125: * @param parent the parent Component.
126: */
127: public static void show(Component parent) {
128: Frame frame = JOptionPane.getFrameForComponent(parent);
129: AboutJigAdmin aj = new AboutJigAdmin(frame, "About JigAdmin",
130: false);
131: aj.setLocationRelativeTo(frame);
132: aj.show();
133: }
134: }
|