01: /*
02: *****************************************************************************
03: * Copyright (C) 2000-2004, International Business Machines Corporation and *
04: * others. All Rights Reserved. *
05: *****************************************************************************
06: */
07: package com.ibm.rbm.gui;
08:
09: import com.ibm.rbm.*;
10: import java.awt.*;
11: import java.awt.event.*;
12: import javax.swing.*;
13:
14: /** A dialog displaying information about this application */
15: class AboutDialog {
16: private static JDialog dialog = null;
17:
18: public static void showDialog(Frame parent) {
19: if (dialog == null) {
20: dialog = new JDialog(parent, Resources
21: .getTranslation("dialog_title_about_rbmanager"),
22: false);
23: initComponents();
24: }
25: dialog.setVisible(true);
26: }
27:
28: private static void initComponents() {
29: dialog.getContentPane().setLayout(new BorderLayout());
30: JLabel logoLabel = null;
31: JLabel titleLabel = new JLabel(Resources
32: .getTranslation("rbmanager"));
33: JLabel versionLabel = new JLabel(Resources.getTranslation(
34: "version", Package.getPackage("com.ibm.rbm")
35: .getImplementationVersion()));
36: JLabel copyrightLabel = new JLabel(Resources
37: .getTranslation("copyright"));
38: JLabel contactLabel = new JLabel(Resources
39: .getTranslation("rbmanager_contact"));
40: JPanel panel = new JPanel();
41: Box box = new Box(BoxLayout.Y_AXIS);
42:
43: try {
44: Class this Class = Class
45: .forName("com.ibm.rbm.gui.AboutDialog");
46: logoLabel = new JLabel(
47: new ImageIcon(
48: this Class
49: .getResource("images/"
50: + Resources
51: .getTranslation("logo_filename"))));
52: } catch (ClassNotFoundException e) {
53: RBManagerGUI.debugMsg(e.toString());
54: }
55:
56: box.add(titleLabel);
57: box.add(versionLabel);
58: box.add(Box.createVerticalStrut(10));
59: box.add(copyrightLabel);
60: box.add(Box.createVerticalStrut(5));
61: box.add(contactLabel);
62:
63: panel.add(box);
64: dialog.getContentPane().add(logoLabel, BorderLayout.WEST);
65: dialog.getContentPane().add(panel, BorderLayout.CENTER);
66:
67: dialog.addMouseListener(new MouseAdapter() {
68: public void mouseReleased(MouseEvent ev) {
69: hideDialog();
70: }
71: });
72:
73: //dialog.validate();
74: dialog.pack();
75: Point parentLoc = dialog.getParent().getLocation();
76: dialog
77: .setLocation(new Point(parentLoc.x + 50,
78: parentLoc.y + 50));
79: dialog.setResizable(false);
80: }
81:
82: private static void hideDialog() {
83: dialog.setVisible(false);
84: dialog.dispose();
85: dialog = null;
86: }
87: }
|