1 /*
1 /*
2 * @(#)Guiffy application - AboutDialog.java 06-Jun-2000
2 * @(#)Guiffy application - AboutDialog.java 06-Jun-2000
3 *
3 *
4 * Copyright (c) 1998 - 2000 Guiffy Software. All Rights Reserved.
4 * Copyright (c) 1998 - 2000 Guiffy Software. All Rights Reserved.
5 * by: Bill W. Ritcher
5 * by: Bill W. Ritcher
6 *
6 *
7 */
7 */
|
8> package com.guiffy.guiffy;
|
9> import com.guiffy.guiffy.*;
8
10
9 import javax.swing.*;
11 import javax.swing.*;
10 import javax.swing.event.*;
12 import javax.swing.event.*;
11 import java.io.*;
13 import java.io.*;
12 import java.awt.*;
14 import java.awt.*;
13 import java.awt.event.*;
15 import java.awt.event.*;
14 import java.util.*;
16 import java.util.*;
15 import java.lang.*;
17 import java.lang.*;
16
18
17
19
18 /**
20 /**
19 * AboutDialog is the About dialog for Guiffy
21 * AboutDialog is the About dialog for Guiffy
20 *
22 *
21 * @version 1.2 24-Jun-2000
23 * @version 1.2 24-Jun-2000
22 * @author Bill W. Ritcher
24 * @author Bill W. Ritcher
23 */
25 */
24 public class AboutDialog extends JDialog {
26 public class AboutDialog extends JDialog {
25 private Frame fr;
27 private Frame fr;
26 private JLabel label1;
28 private JLabel label1;
27< private JLabel label2;
29> private JLabel label2a;
|
30> private JLabel label2;
28 private JLabel label3;
31 private JLabel label3;
29 private JLabel label4;
32 private JLabel label4;
30 private JButton okButton;
33 private JButton okButton;
31
34
32 /**
35 /**
33 * Creates an AboutDialog
36 * Creates an AboutDialog
34 * @param parent the parent Frame
37 * @param parent the parent Frame
35 * @param modal a boolean parameter for modal dialog behavior
38 * @param modal a boolean parameter for modal dialog behavior
36 */
39 */
37 public AboutDialog(Frame parent, boolean modal) {
40 public AboutDialog(Frame parent, boolean modal) {
38
41
39< super(parent, ReBu.Grbget("ad_title") + " Guiffy 1.4 ", modal);
42> super(parent, ReBu.Grbget("ad_title") + " Guiffy 1.5 ", modal);
40 fr = parent;
43 fr = parent;
41 // Create the dialog components...
44 // Create the dialog components...
42 createComponents();
45 createComponents();
43 }
46 }
44
47
45 /**
48 /**
46 * Returns the AboutDialog Preferred Size - will be called by the layout.
49 * Returns the AboutDialog Preferred Size - will be called by the layout.
47 * @return the dialog's preferred size
50 * @return the dialog's preferred size
48 */
51 */
49 public Dimension getPreferredSize() {
52 public Dimension getPreferredSize() {
50< return new Dimension(357, 22 8);
53> return new Dimension(357, 24 8);
51 }
54 }
52
55
53 // Create the main display panel...
56 // Create the main display panel...
54 private void createComponents() {
57 private void createComponents() {
55 // INIT_CONTROLS
58 // INIT_CONTROLS
56 getContentPane().setLayout(null);
59 getContentPane().setLayout(null);
57 setVisible(false);
60 setVisible(false);
58 label1 = new JLabel("Guiffy - GUI interface for Jiffy(File Differ)");
61 label1 = new JLabel("Guiffy - GUI interface for Jiffy(File Differ)");
59 label1.setBounds(60,30,251,21);
62 label1.setBounds(60,30,251,21);
60 getContentPane().add(label1);
63 getContentPane().add(label1);
61< label2 = new JLabel("by Bill Ritcher, Guiffy Software - Copyright 1998 - 2000");
64> label2a = new JLabel("Created by Bill Ritcher");
62< label2.setBounds(10 ,50,351,21);
65> label2a.setBounds(104 ,50,351,21);
|
66> getContentPane().add(label2a);
|
67> label2 = new JLabel("Guiffy Software, Inc. - Copyright 1998 - 2000");
|
68> label2.setBounds(50,70,351,21);
63 getContentPane().add(label2);
69 getContentPane().add(label2);
64< label3 = new JLabel("Guiffy 1.4 - Build 45 ");
70> label3 = new JLabel("Guiffy 1.5 - Build 46 ");
65< label3.setBounds(110,7 0,251,21);
71> label3.setBounds(110,9 0,251,21);
66 getContentPane().add(label3);
72 getContentPane().add(label3);
67
73
68 Properties prop = new Properties(System.getProperties() );
74 Properties prop = new Properties(System.getProperties() );
69 String Java_Ver = prop.getProperty( "java.version" );
75 String Java_Ver = prop.getProperty( "java.version" );
70< // String Java_Ven = prop.getProperty( "java.vendor" );
|
71< // String Java_Cla = prop.getProperty( "java.class.version" );
|
72< // String Java_Com = prop.getProperty( "java.compiler" );
|
73 // String OS_Nam = prop.getProperty( "os.name" );
76 // String OS_Nam = prop.getProperty( "os.name" );
74 // String OS_Arc = prop.getProperty( "os.arch" );
77 // String OS_Arc = prop.getProperty( "os.arch" );
75 // String OS_Ver = prop.getProperty( "os.version" );
78 // String OS_Ver = prop.getProperty( "os.version" );
76 label4 = new JLabel("On JDK/JRE - " + Java_Ver);
79 label4 = new JLabel("On JDK/JRE - " + Java_Ver);
77< label4.setBounds(110,10 0,251,21);
80> label4.setBounds(110,12 0,251,21);
78 getContentPane().add(label4);
81 getContentPane().add(label4);
79
82
80 okButton = new JButton();
83 okButton = new JButton();
81 okButton.setText("OK");
84 okButton.setText("OK");
82 Font ButFont = new Font("Monospaced", Font.BOLD, 14);
85 Font ButFont = new Font("Monospaced", Font.BOLD, 14);
83 okButton.setFont(ButFont);
86 okButton.setFont(ButFont);
84< okButton.setBounds(120,15 0,95,32);
87> okButton.setBounds(120,17 0,95,32);
85 AboutActionListener actionListener = new AboutActionListener();
88 AboutActionListener actionListener = new AboutActionListener();
86 okButton.addActionListener(actionListener);
89 okButton.addActionListener(actionListener);
87 okButton.setActionCommand("OK");
90 okButton.setActionCommand("OK");
88 getContentPane().add(okButton);
91 getContentPane().add(okButton);
89
92
90 getRootPane().setDefaultButton(okButton);
93 getRootPane().setDefaultButton(okButton);
91
94
92 // REGISTER_LISTENERS
95 // REGISTER_LISTENERS
93 addWindowListener( new WindowListener() {
96 addWindowListener( new WindowListener() {
94 public void windowClosing(WindowEvent e) { setVisible(false); }
97 public void windowClosing(WindowEvent e) { setVisible(false); }
95 public void windowOpened(WindowEvent e) { }
98 public void windowOpened(WindowEvent e) { }
96 public void windowClosed(WindowEvent e) { }
99 public void windowClosed(WindowEvent e) { }
97 public void windowIconified(WindowEvent e) { }
100 public void windowIconified(WindowEvent e) { }
98 public void windowDeiconified(WindowEvent e) { }
101 public void windowDeiconified(WindowEvent e) { }
99 public void windowActivated(WindowEvent e) { }
102 public void windowActivated(WindowEvent e) { }
100 public void windowDeactivated(WindowEvent e) { }
103 public void windowDeactivated(WindowEvent e) { }
101 });
104 });
102 }
105 }
103
106
104 /**
107 /**
105 * Shows the AboutDialog in the center of the parent frame.
108 * Shows the AboutDialog in the center of the parent frame.
106 */
109 */
107 public void showAbout() {
110 public void showAbout() {
108 // Resize to fit everything...
111 // Resize to fit everything...
109 setSize(getPreferredSize());
112 setSize(getPreferredSize());
110 // center it
113 // center it
111 Rectangle bounds = getParent().getBounds();
114 Rectangle bounds = getParent().getBounds();
112 Rectangle abounds = getBounds();
115 Rectangle abounds = getBounds();
113 setLocation(bounds.x + (bounds.width - abounds.width)/ 2,
116 setLocation(bounds.x + (bounds.width - abounds.width)/ 2,
114 bounds.y + (bounds.height - abounds.height)/2);
117 bounds.y + (bounds.height - abounds.height)/2);
115
118
116 super.setVisible(true);
119 super.setVisible(true);
117 }
120 }
118
121
119 private class AboutActionListener implements ActionListener {
122 private class AboutActionListener implements ActionListener {
120 /**
123 /**
121 * Sets the dialog not visible when OK is clicked
124 * Sets the dialog not visible when OK is clicked
122 */
125 */
123 public void actionPerformed(ActionEvent e) {
126 public void actionPerformed(ActionEvent e) {
124 String cmd = e.getActionCommand();
127 String cmd = e.getActionCommand();
125 if(cmd.equals("OK")) {
128 if(cmd.equals("OK")) {
126 setVisible(false);
129 setVisible(false);
127 }
130 }
128 }
131 }
129 }
132 }
130 }
133 }
131
134