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