001: /*
002: * WbAboutDialog.java
003: *
004: * This file is part of SQL Workbench/J, http://www.sql-workbench.net
005: *
006: * Copyright 2002-2008, Thomas Kellerer
007: * No part of this code maybe reused without the permission of the author
008: *
009: * To contact the author please send an email to: support@sql-workbench.net
010: *
011: */
012: package workbench.gui.dialogs;
013:
014: import java.awt.Cursor;
015: import java.awt.event.ActionEvent;
016: import java.awt.event.ActionListener;
017:
018: import javax.swing.ActionMap;
019: import javax.swing.InputMap;
020: import javax.swing.JComponent;
021:
022: import javax.swing.JDialog;
023: import workbench.gui.actions.EscAction;
024: import workbench.resource.ResourceMgr;
025: import workbench.util.BrowserLauncher;
026:
027: /**
028: *
029: * @author support@sql-workbench.net
030: */
031: public class WbAboutDialog extends JDialog implements ActionListener {
032: private EscAction escAction;
033:
034: public WbAboutDialog(java.awt.Frame parent) {
035: super (parent, true);
036: initComponents();
037: homepageLabel.setCursor(Cursor
038: .getPredefinedCursor(Cursor.HAND_CURSOR));
039: mailToLabel.setCursor(Cursor
040: .getPredefinedCursor(Cursor.HAND_CURSOR));
041: builtWithNbLabel.setCursor(Cursor
042: .getPredefinedCursor(Cursor.HAND_CURSOR));
043: jeditLabel.setCursor(Cursor
044: .getPredefinedCursor(Cursor.HAND_CURSOR));
045:
046: getRootPane().setDefaultButton(closeButton);
047: InputMap im = this .getRootPane().getInputMap(
048: JComponent.WHEN_IN_FOCUSED_WINDOW);
049: ActionMap am = this .getRootPane().getActionMap();
050: escAction = new EscAction(this );
051: escAction.addToInputMap(im, am);
052: }
053:
054: /** This method is called from within the constructor to
055: * initialize the form.
056: * WARNING: Do NOT modify this code. The content of this method is
057: * always regenerated by the Form Editor.
058: */
059: // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
060: private void initComponents() {
061: java.awt.GridBagConstraints gridBagConstraints;
062:
063: buttonPanel = new javax.swing.JPanel();
064: closeButton = new javax.swing.JButton();
065: contentPanel = new javax.swing.JPanel();
066: logo = new javax.swing.JLabel();
067: labelTitel = new javax.swing.JLabel();
068: labelDesc = new javax.swing.JLabel();
069: labelVersion = new javax.swing.JLabel();
070: labelCopyright = new javax.swing.JLabel();
071: builtWithNbLabel = new javax.swing.JLabel();
072: jeditLabel = new javax.swing.JLabel();
073: jdkVersion = new javax.swing.JLabel();
074: homepageLabel = new javax.swing.JLabel();
075: mailToLabel = new javax.swing.JLabel();
076:
077: setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
078: setTitle(ResourceMgr.getString("TxtAbout") + " "
079: + ResourceMgr.TXT_PRODUCT_NAME);
080: setName("AboutDialog"); // NOI18N
081: addWindowListener(new java.awt.event.WindowAdapter() {
082: public void windowClosing(java.awt.event.WindowEvent evt) {
083: closeDialog(evt);
084: }
085: });
086:
087: buttonPanel.setLayout(new java.awt.FlowLayout(
088: java.awt.FlowLayout.RIGHT));
089:
090: closeButton.setText(ResourceMgr.getString("LblClose"));
091: closeButton
092: .addActionListener(new java.awt.event.ActionListener() {
093: public void actionPerformed(
094: java.awt.event.ActionEvent evt) {
095: closeButtonActionPerformed(evt);
096: }
097: });
098: buttonPanel.add(closeButton);
099:
100: getContentPane().add(buttonPanel, java.awt.BorderLayout.SOUTH);
101:
102: contentPanel.setLayout(new java.awt.GridBagLayout());
103:
104: logo.setIcon(new javax.swing.ImageIcon(getClass().getResource(
105: "/workbench/resource/images/hitchguide.gif"))); // NOI18N
106: logo.setBorder(javax.swing.BorderFactory.createEtchedBorder());
107: logo.setIconTextGap(0);
108: logo.setMaximumSize(new java.awt.Dimension(172, 128));
109: logo.setMinimumSize(new java.awt.Dimension(172, 128));
110: logo.setPreferredSize(new java.awt.Dimension(172, 128));
111: gridBagConstraints = new java.awt.GridBagConstraints();
112: gridBagConstraints.gridx = 0;
113: gridBagConstraints.gridy = 0;
114: gridBagConstraints.gridheight = 7;
115: gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
116: gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 0);
117: contentPanel.add(logo, gridBagConstraints);
118:
119: labelTitel.setFont(new java.awt.Font("Dialog", 1, 14));
120: labelTitel.setText(ResourceMgr.TXT_PRODUCT_NAME);
121: gridBagConstraints = new java.awt.GridBagConstraints();
122: gridBagConstraints.gridx = 1;
123: gridBagConstraints.gridy = 0;
124: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
125: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
126: gridBagConstraints.weightx = 1.0;
127: gridBagConstraints.insets = new java.awt.Insets(6, 8, 0, 4);
128: contentPanel.add(labelTitel, gridBagConstraints);
129:
130: labelDesc.setText(ResourceMgr
131: .getString("TxtProductDescription"));
132: gridBagConstraints = new java.awt.GridBagConstraints();
133: gridBagConstraints.gridx = 1;
134: gridBagConstraints.gridy = 1;
135: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
136: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
137: gridBagConstraints.insets = new java.awt.Insets(0, 8, 0, 4);
138: contentPanel.add(labelDesc, gridBagConstraints);
139:
140: labelVersion.setText(ResourceMgr.getBuildInfo());
141: gridBagConstraints = new java.awt.GridBagConstraints();
142: gridBagConstraints.gridx = 1;
143: gridBagConstraints.gridy = 2;
144: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
145: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
146: gridBagConstraints.insets = new java.awt.Insets(0, 8, 0, 4);
147: contentPanel.add(labelVersion, gridBagConstraints);
148:
149: labelCopyright.setText(ResourceMgr.getString("TxtCopyright"));
150: gridBagConstraints = new java.awt.GridBagConstraints();
151: gridBagConstraints.gridx = 1;
152: gridBagConstraints.gridy = 4;
153: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
154: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
155: gridBagConstraints.insets = new java.awt.Insets(12, 8, 0, 4);
156: contentPanel.add(labelCopyright, gridBagConstraints);
157:
158: builtWithNbLabel
159: .setText("<html>Built with NetBeans (<u>www.netbeans.org</u>)</html>");
160: builtWithNbLabel
161: .addMouseListener(new java.awt.event.MouseAdapter() {
162: public void mouseClicked(
163: java.awt.event.MouseEvent evt) {
164: builtWithNbLabelMouseClicked(evt);
165: }
166: });
167: gridBagConstraints = new java.awt.GridBagConstraints();
168: gridBagConstraints.gridx = 0;
169: gridBagConstraints.gridy = 7;
170: gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
171: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
172: gridBagConstraints.insets = new java.awt.Insets(4, 5, 0, 4);
173: contentPanel.add(builtWithNbLabel, gridBagConstraints);
174:
175: jeditLabel
176: .setText("<html>The editor is based on jEdit's 2.2.1 <u>syntax highlighting package</u></html>");
177: jeditLabel.addMouseListener(new java.awt.event.MouseAdapter() {
178: public void mouseClicked(java.awt.event.MouseEvent evt) {
179: jeditLabelMouseClicked(evt);
180: }
181: });
182: gridBagConstraints = new java.awt.GridBagConstraints();
183: gridBagConstraints.gridx = 0;
184: gridBagConstraints.gridy = 8;
185: gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
186: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
187: gridBagConstraints.insets = new java.awt.Insets(0, 5, 5, 4);
188: contentPanel.add(jeditLabel, gridBagConstraints);
189:
190: jdkVersion.setText(ResourceMgr.getString("TxtJavaVersion")
191: + " " + System.getProperty("java.version"));
192: gridBagConstraints = new java.awt.GridBagConstraints();
193: gridBagConstraints.gridx = 1;
194: gridBagConstraints.gridy = 3;
195: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
196: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
197: gridBagConstraints.insets = new java.awt.Insets(0, 8, 0, 4);
198: contentPanel.add(jdkVersion, gridBagConstraints);
199:
200: homepageLabel
201: .setText("<html><u>www.sql-workbench.net</u></html>");
202: homepageLabel
203: .addMouseListener(new java.awt.event.MouseAdapter() {
204: public void mouseClicked(
205: java.awt.event.MouseEvent evt) {
206: homepageLabelMouseClicked(evt);
207: }
208: });
209: gridBagConstraints = new java.awt.GridBagConstraints();
210: gridBagConstraints.gridx = 1;
211: gridBagConstraints.gridy = 5;
212: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
213: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
214: gridBagConstraints.insets = new java.awt.Insets(0, 8, 0, 4);
215: contentPanel.add(homepageLabel, gridBagConstraints);
216:
217: mailToLabel.setText("support@sql-workbench.net");
218: mailToLabel.addMouseListener(new java.awt.event.MouseAdapter() {
219: public void mouseClicked(java.awt.event.MouseEvent evt) {
220: mailToLabelMouseClicked(evt);
221: }
222: });
223: gridBagConstraints = new java.awt.GridBagConstraints();
224: gridBagConstraints.gridx = 1;
225: gridBagConstraints.gridy = 6;
226: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
227: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
228: gridBagConstraints.insets = new java.awt.Insets(0, 8, 0, 4);
229: contentPanel.add(mailToLabel, gridBagConstraints);
230:
231: getContentPane()
232: .add(contentPanel, java.awt.BorderLayout.CENTER);
233:
234: pack();
235: }// </editor-fold>//GEN-END:initComponents
236:
237: private void mailToLabelMouseClicked(java.awt.event.MouseEvent evt)//GEN-FIRST:event_mailToLabelMouseClicked
238: {//GEN-HEADEREND:event_mailToLabelMouseClicked
239: try {
240: if (evt.getClickCount() == 1)
241: BrowserLauncher
242: .openURL("mailto:support@sql-workbench.net");
243: } catch (Exception e) {
244: }
245:
246: }//GEN-LAST:event_mailToLabelMouseClicked
247:
248: private void homepageLabelMouseClicked(java.awt.event.MouseEvent evt)//GEN-FIRST:event_homepageLabelMouseClicked
249: {//GEN-HEADEREND:event_homepageLabelMouseClicked
250: try {
251: if (evt.getClickCount() == 1)
252: BrowserLauncher.openURL("http://www.sql-workbench.net");
253: } catch (Exception e) {
254: }
255: }//GEN-LAST:event_homepageLabelMouseClicked
256:
257: private void builtWithNbLabelMouseClicked(
258: java.awt.event.MouseEvent evt) {//GEN-FIRST:event_builtWithNbLabelMouseClicked
259: try {
260: if (evt.getClickCount() == 1)
261: BrowserLauncher.openURL("http://www.netbeans.org");
262: } catch (Exception e) {
263: }
264: }//GEN-LAST:event_builtWithNbLabelMouseClicked
265:
266: private void closeButtonActionPerformed(
267: java.awt.event.ActionEvent evt)//GEN-FIRST:event_closeButtonActionPerformed
268: {//GEN-HEADEREND:event_closeButtonActionPerformed
269: this .closeDialog(null);
270: }//GEN-LAST:event_closeButtonActionPerformed
271:
272: private void closeDialog(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_closeDialog
273: setVisible(false);
274: dispose();
275: }//GEN-LAST:event_closeDialog
276:
277: private void jeditLabelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jeditLabelMouseClicked
278: try {
279: if (evt.getClickCount() == 1)
280: BrowserLauncher.openURL("http://syntax.jedit.org/");
281: } catch (Exception e) {
282: }
283: }//GEN-LAST:event_jeditLabelMouseClicked
284:
285: public void actionPerformed(ActionEvent e) {
286: if (e.getSource() == escAction) {
287: closeDialog(null);
288: }
289: }
290:
291: // Variables declaration - do not modify//GEN-BEGIN:variables
292: private javax.swing.JLabel builtWithNbLabel;
293: private javax.swing.JPanel buttonPanel;
294: private javax.swing.JButton closeButton;
295: private javax.swing.JPanel contentPanel;
296: private javax.swing.JLabel homepageLabel;
297: private javax.swing.JLabel jdkVersion;
298: private javax.swing.JLabel jeditLabel;
299: private javax.swing.JLabel labelCopyright;
300: private javax.swing.JLabel labelDesc;
301: private javax.swing.JLabel labelTitel;
302: private javax.swing.JLabel labelVersion;
303: private javax.swing.JLabel logo;
304: private javax.swing.JLabel mailToLabel;
305: // End of variables declaration//GEN-END:variables
306:
307: }
|