[Japi-cvs] SF.net SVN: japi:[774] libs/swing-about/trunk/src/prj/net/sf/japi/swing/ about/AboutDial
Status: Beta
Brought to you by:
christianhujer
|
From: <aki...@us...> - 2009-01-09 20:33:10
|
Revision: 774
http://japi.svn.sourceforge.net/japi/?rev=774&view=rev
Author: akirschbaum
Date: 2009-01-09 20:33:00 +0000 (Fri, 09 Jan 2009)
Log Message:
-----------
Allow copying text from about tab.
Modified Paths:
--------------
libs/swing-about/trunk/src/prj/net/sf/japi/swing/about/AboutDialog.java
Modified: libs/swing-about/trunk/src/prj/net/sf/japi/swing/about/AboutDialog.java
===================================================================
--- libs/swing-about/trunk/src/prj/net/sf/japi/swing/about/AboutDialog.java 2008-12-30 04:38:38 UTC (rev 773)
+++ libs/swing-about/trunk/src/prj/net/sf/japi/swing/about/AboutDialog.java 2009-01-09 20:33:00 UTC (rev 774)
@@ -22,6 +22,8 @@
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Font;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
@@ -34,6 +36,7 @@
import java.util.ResourceBundle;
import java.util.TreeSet;
import javax.swing.ImageIcon;
+import javax.swing.JEditorPane;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
@@ -41,6 +44,7 @@
import javax.swing.JTabbedPane;
import javax.swing.JTextArea;
import javax.swing.SwingConstants;
+import javax.swing.UIManager;
import net.sf.japi.swing.ActionBuilder;
import net.sf.japi.swing.ActionBuilderFactory;
import org.jetbrains.annotations.NotNull;
@@ -264,7 +268,16 @@
} catch (final MissingResourceException ignore) {
/* ignore */
}
- final Component aboutTab = new JLabel(actionBuilder.format("about", System.getProperty("java.version"), buildNumber, buildDeveloper, buildTstamp), SwingConstants.CENTER);
+ // use a JEditorPane which looks like a JLabel to allow copying its content
+ final JEditorPane editorPane = new JEditorPane("text/html", actionBuilder.format("about", System.getProperty("java.version"), buildNumber, buildDeveloper, buildTstamp));
+ editorPane.setEditable(false);
+ editorPane.setBorder(null);
+ editorPane.setForeground(UIManager.getColor("Label.foreground"));
+ editorPane.setFont(UIManager.getFont("Label.font"));
+ editorPane.setOpaque(false);
+ final JPanel aboutTab = new JPanel(new GridBagLayout());
+ final GridBagConstraints gbc = new GridBagConstraints();
+ aboutTab.add(editorPane, gbc);
aboutTab.setName(ACTION_BUILDER.getString("aboutTab.title"));
return aboutTab;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|