12e5b6d6dSopenharmony_ci/*
22e5b6d6dSopenharmony_ci *****************************************************************************
32e5b6d6dSopenharmony_ci * Copyright (C) 2000-2004, International Business Machines Corporation and  *
42e5b6d6dSopenharmony_ci * others. All Rights Reserved.                                              *
52e5b6d6dSopenharmony_ci *****************************************************************************
62e5b6d6dSopenharmony_ci */
72e5b6d6dSopenharmony_cipackage com.ibm.rbm.gui;
82e5b6d6dSopenharmony_ci
92e5b6d6dSopenharmony_ciimport com.ibm.rbm.*;
102e5b6d6dSopenharmony_ciimport java.awt.*;
112e5b6d6dSopenharmony_ciimport java.awt.event.*;
122e5b6d6dSopenharmony_ciimport javax.swing.*;
132e5b6d6dSopenharmony_ci
142e5b6d6dSopenharmony_ci
152e5b6d6dSopenharmony_ci/** A dialog displaying information about this application */
162e5b6d6dSopenharmony_ciclass AboutDialog {
172e5b6d6dSopenharmony_ci	private static JDialog dialog = null;
182e5b6d6dSopenharmony_ci
192e5b6d6dSopenharmony_ci	public static void showDialog(Frame parent) {
202e5b6d6dSopenharmony_ci		if (dialog == null) {
212e5b6d6dSopenharmony_ci			dialog = new JDialog(parent, Resources.getTranslation("dialog_title_about_rbmanager"), false);
222e5b6d6dSopenharmony_ci			initComponents();
232e5b6d6dSopenharmony_ci		}
242e5b6d6dSopenharmony_ci		dialog.setVisible(true);
252e5b6d6dSopenharmony_ci	}
262e5b6d6dSopenharmony_ci
272e5b6d6dSopenharmony_ci	private static void initComponents() {
282e5b6d6dSopenharmony_ci		dialog.getContentPane().setLayout(new BorderLayout());
292e5b6d6dSopenharmony_ci        JLabel logoLabel = null;
302e5b6d6dSopenharmony_ci		JLabel titleLabel = new JLabel(Resources.getTranslation("rbmanager"));
312e5b6d6dSopenharmony_ci		JLabel versionLabel = new JLabel(Resources.getTranslation("version", Package.getPackage("com.ibm.rbm").getImplementationVersion()));
322e5b6d6dSopenharmony_ci		JLabel copyrightLabel = new JLabel(Resources.getTranslation("copyright"));
332e5b6d6dSopenharmony_ci		JLabel contactLabel = new JLabel(Resources.getTranslation("rbmanager_contact"));
342e5b6d6dSopenharmony_ci		JPanel panel = new JPanel();
352e5b6d6dSopenharmony_ci		Box box = new Box(BoxLayout.Y_AXIS);
362e5b6d6dSopenharmony_ci
372e5b6d6dSopenharmony_ci        try {
382e5b6d6dSopenharmony_ci            Class thisClass = Class.forName("com.ibm.rbm.gui.AboutDialog");
392e5b6d6dSopenharmony_ci		    logoLabel = new JLabel(new ImageIcon(thisClass.getResource("images/" +
402e5b6d6dSopenharmony_ci									      Resources.getTranslation("logo_filename"))));
412e5b6d6dSopenharmony_ci        } catch (ClassNotFoundException e) {
422e5b6d6dSopenharmony_ci            RBManagerGUI.debugMsg(e.toString());
432e5b6d6dSopenharmony_ci        }
442e5b6d6dSopenharmony_ci
452e5b6d6dSopenharmony_ci		box.add(titleLabel);
462e5b6d6dSopenharmony_ci		box.add(versionLabel);
472e5b6d6dSopenharmony_ci		box.add(Box.createVerticalStrut(10));
482e5b6d6dSopenharmony_ci		box.add(copyrightLabel);
492e5b6d6dSopenharmony_ci		box.add(Box.createVerticalStrut(5));
502e5b6d6dSopenharmony_ci		box.add(contactLabel);
512e5b6d6dSopenharmony_ci
522e5b6d6dSopenharmony_ci		panel.add(box);
532e5b6d6dSopenharmony_ci		dialog.getContentPane().add(logoLabel, BorderLayout.WEST);
542e5b6d6dSopenharmony_ci		dialog.getContentPane().add(panel, BorderLayout.CENTER);
552e5b6d6dSopenharmony_ci
562e5b6d6dSopenharmony_ci		dialog.addMouseListener(new MouseAdapter() {
572e5b6d6dSopenharmony_ci			public void mouseReleased(MouseEvent ev) {
582e5b6d6dSopenharmony_ci				hideDialog();
592e5b6d6dSopenharmony_ci			}
602e5b6d6dSopenharmony_ci		});
612e5b6d6dSopenharmony_ci
622e5b6d6dSopenharmony_ci		//dialog.validate();
632e5b6d6dSopenharmony_ci		dialog.pack();
642e5b6d6dSopenharmony_ci		Point parentLoc = dialog.getParent().getLocation();
652e5b6d6dSopenharmony_ci		dialog.setLocation(new Point(parentLoc.x + 50, parentLoc.y + 50));
662e5b6d6dSopenharmony_ci		dialog.setResizable(false);
672e5b6d6dSopenharmony_ci	}
682e5b6d6dSopenharmony_ci
692e5b6d6dSopenharmony_ci	private static void hideDialog() {
702e5b6d6dSopenharmony_ci		dialog.setVisible(false);
712e5b6d6dSopenharmony_ci		dialog.dispose();
722e5b6d6dSopenharmony_ci		dialog = null;
732e5b6d6dSopenharmony_ci	}
742e5b6d6dSopenharmony_ci}
75