Author: bobtarling
Date: 2008-06-29 13:20:14-0700
New Revision: 15109
Modified:
trunk/src/argouml-app/src/org/argouml/uml/ui/TabDocumentation.java
Log:
Only override background color if it is supplied by the look and feel
Modified: trunk/src/argouml-app/src/org/argouml/uml/ui/TabDocumentation.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/ui/TabDocumentation.java?view=diff&rev=15109&p1=trunk/src/argouml-app/src/org/argouml/uml/ui/TabDocumentation.java&p2=trunk/src/argouml-app/src/org/argouml/uml/ui/TabDocumentation.java&r1=15108&r2=15109
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/ui/TabDocumentation.java (original)
+++ trunk/src/argouml-app/src/org/argouml/uml/ui/TabDocumentation.java 2008-06-29 13:20:14-0700
@@ -1,5 +1,5 @@
// $Id$
-// Copyright (c) 1996-2007 The Regents of the University of California. All
+// Copyright (c) 1996-2008 The Regents of the University of California. All
// Rights Reserved. Permission to use, copy, modify, and distribute this
// software and its documentation without fee, and without a written
// agreement is hereby granted, provided that the above copyright notice
@@ -28,6 +28,7 @@
import javax.swing.ImageIcon;
import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
import javax.swing.UIManager;
import org.argouml.application.api.Argo;
@@ -121,15 +122,7 @@
// Comment.name text field - editing disabled
UMLTextArea2 comment = new UMLTextArea2(
new UMLModelElementCommentDocument(false));
- comment.setRows(2);
- comment.setLineWrap(true);
- comment.setWrapStyleWord(true);
- comment.setEnabled(false);
- comment.setDisabledTextColor(comment.getForeground());
- // See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4919687
- Color c = new Color(
- UIManager.getColor("TextField.inactiveBackground").getRGB());
- comment.setBackground(c);
+ disableTextArea(comment);
JScrollPane spComment = new JScrollPane();
spComment.getViewport().add(comment);
addField(Translator.localize("label.comment.name"), spComment);
@@ -137,12 +130,7 @@
// Comment.body text field - editing disabled
UMLTextArea2 commentBody = new UMLTextArea2(
new UMLModelElementCommentDocument(true));
- commentBody.setRows(2);
- commentBody.setLineWrap(true);
- commentBody.setWrapStyleWord(true);
- commentBody.setEnabled(false);
- commentBody.setDisabledTextColor(comment.getForeground());
- commentBody.setBackground(c);
+ disableTextArea(commentBody);
JScrollPane spCommentBody = new JScrollPane();
spCommentBody.getViewport().add(commentBody);
addField(Translator.localize("label.comment.body"), spCommentBody);
@@ -152,6 +140,22 @@
* title would not be aligned right. */
setButtonPanelSize(18);
}
+
+ private void disableTextArea(final JTextArea textArea) {
+ textArea.setRows(2);
+ textArea.setLineWrap(true);
+ textArea.setWrapStyleWord(true);
+ textArea.setEnabled(false);
+ textArea.setDisabledTextColor(textArea.getForeground());
+ // Only change the background colour if it is supplied by the LAF.
+ // Otherwise leave look and feel to handle this itself.
+ final Color inactiveColor =
+ UIManager.getColor("TextField.inactiveBackground");
+ if (inactiveColor != null) {
+ // See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4919687
+ textArea.setBackground(new Color(inactiveColor.getRGB()));
+ }
+ }
/**
* Checks if the tab should be enabled. Returns true if the target
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.