summaryrefslogtreecommitdiff
path: root/javax/swing/plaf/basic/BasicLookAndFeel.java
diff options
context:
space:
mode:
Diffstat (limited to 'javax/swing/plaf/basic/BasicLookAndFeel.java')
-rw-r--r--javax/swing/plaf/basic/BasicLookAndFeel.java142
1 files changed, 95 insertions, 47 deletions
diff --git a/javax/swing/plaf/basic/BasicLookAndFeel.java b/javax/swing/plaf/basic/BasicLookAndFeel.java
index 67cf25057..54d91d888 100644
--- a/javax/swing/plaf/basic/BasicLookAndFeel.java
+++ b/javax/swing/plaf/basic/BasicLookAndFeel.java
@@ -15,8 +15,8 @@ General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
@@ -47,10 +47,12 @@ import java.io.Serializable;
import java.util.Enumeration;
import java.util.ResourceBundle;
-import javax.swing.ImageIcon;
+import javax.swing.BorderFactory;
import javax.swing.KeyStroke;
import javax.swing.LookAndFeel;
import javax.swing.UIDefaults;
+import javax.swing.border.BevelBorder;
+import javax.swing.border.Border;
import javax.swing.plaf.BorderUIResource;
import javax.swing.plaf.ColorUIResource;
import javax.swing.plaf.DimensionUIResource;
@@ -69,7 +71,7 @@ public abstract class BasicLookAndFeel extends LookAndFeel
static final long serialVersionUID = -6096995660290287879L;
/**
- * Constructor BasicLookAndFeel
+ * Creates a new instance of the Basic look and feel.
*/
public BasicLookAndFeel()
{
@@ -77,8 +79,10 @@ public abstract class BasicLookAndFeel extends LookAndFeel
}
/**
- * getDefaults
- * @return UIDefaults
+ * Creates and returns a new instance of the default resources for this look
+ * and feel.
+ *
+ * @return The UI defaults.
*/
public UIDefaults getDefaults()
{
@@ -95,8 +99,10 @@ public abstract class BasicLookAndFeel extends LookAndFeel
}
/**
- * initClassDefaults
- * @param value0 TODO
+ * Populates the <code>defaults</code> table with mappings between class IDs
+ * and fully qualified class names for the UI delegates.
+ *
+ * @param defaults the defaults table (<code>null</code> not permitted).
*/
protected void initClassDefaults(UIDefaults defaults)
{
@@ -155,8 +161,9 @@ public abstract class BasicLookAndFeel extends LookAndFeel
}
/**
- * initSystemColorDefaults
- * @param defaults TODO
+ * Populates the <code>defaults</code> table with system color defaults.
+ *
+ * @param defaults the defaults table (<code>null</code> not permitted).
*/
protected void initSystemColorDefaults(UIDefaults defaults)
{
@@ -198,13 +205,14 @@ public abstract class BasicLookAndFeel extends LookAndFeel
}
/**
- * loadSystemColors
- * @param defaults TODO
- * @param value1 TODO
- * @param value2 TODO
+ * Loads the system colors. This method is not implemented yet.
+ *
+ * @param defaults the defaults table (<code>null</code> not permitted).
+ * @param systemColors TODO
+ * @param useNative TODO
*/
- protected void loadSystemColors(UIDefaults defaults, String[] value1,
- boolean value2)
+ protected void loadSystemColors(UIDefaults defaults, String[] systemColors,
+ boolean useNative)
{
// TODO
}
@@ -232,7 +240,7 @@ public abstract class BasicLookAndFeel extends LookAndFeel
/**
* initComponentDefaults
- * @param defaults TODO
+ * @param defaults the defaults table (<code>null</code> not permitted).
*/
protected void initComponentDefaults(UIDefaults defaults)
{
@@ -247,7 +255,7 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"AbstractUndoableEdit.undoText", "Undo",
"AbstractUndoableEdit.redoText", "Redo",
- "Button.background", new ColorUIResource(light),
+ "Button.background", new ColorUIResource(Color.LIGHT_GRAY),
"Button.border",
new UIDefaults.LazyValue()
{
@@ -256,17 +264,17 @@ public abstract class BasicLookAndFeel extends LookAndFeel
return BasicBorders.getButtonBorder();
}
},
- "Button.darkShadow", new ColorUIResource(shadow),
+ "Button.darkShadow", new ColorUIResource(Color.BLACK),
"Button.focusInputMap", new UIDefaults.LazyInputMap(new Object[] {
"SPACE", "pressed",
"released SPACE", "released"
}),
"Button.font", new FontUIResource("Dialog", Font.PLAIN, 12),
- "Button.foreground", new ColorUIResource(darkShadow),
- "Button.highlight", new ColorUIResource(highLight),
- "Button.light", new ColorUIResource(highLight),
+ "Button.foreground", new ColorUIResource(Color.BLACK),
+ "Button.highlight", new ColorUIResource(Color.WHITE),
+ "Button.light", new ColorUIResource(Color.LIGHT_GRAY),
"Button.margin", new InsetsUIResource(2, 2, 2, 2),
- "Button.shadow", new ColorUIResource(shadow),
+ "Button.shadow", new ColorUIResource(Color.GRAY),
"Button.textIconGap", new Integer(4),
"Button.textShiftOffset", new Integer(0),
"CheckBox.background", new ColorUIResource(light),
@@ -278,7 +286,14 @@ public abstract class BasicLookAndFeel extends LookAndFeel
}),
"CheckBox.font", new FontUIResource("Dialog", Font.PLAIN, 12),
"CheckBox.foreground", new ColorUIResource(darkShadow),
- "CheckBox.icon", BasicIconFactory.getCheckBoxIcon(),
+ "CheckBox.icon",
+ new UIDefaults.LazyValue()
+ {
+ public Object createValue(UIDefaults def)
+ {
+ return BasicIconFactory.getCheckBoxIcon();
+ }
+ },
"CheckBox.margin",new InsetsUIResource(2, 2, 2, 2),
"CheckBox.textIconGap", new Integer(4),
"CheckBox.textShiftOffset", new Integer(0),
@@ -449,15 +464,39 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"InternalFrame.activeTitleBackground", new ColorUIResource(0, 0, 128),
"InternalFrame.activeTitleForeground", new ColorUIResource(Color.white),
"InternalFrame.border",
- new BorderUIResource.CompoundBorderUIResource(null, null),
+ new UIDefaults.LazyValue()
+ {
+ public Object createValue(UIDefaults table)
+ {
+ Color lineColor = new Color(238, 238, 238);
+ Border inner = BorderFactory.createLineBorder(lineColor, 1);
+ Color shadowInner = new Color(184, 207, 229);
+ Color shadowOuter = new Color(122, 138, 153);
+ Border outer = BorderFactory.createBevelBorder(BevelBorder.RAISED,
+ Color.WHITE,
+ Color.WHITE,
+ shadowOuter,
+ shadowInner);
+ Border border = new BorderUIResource.CompoundBorderUIResource(outer,
+ inner);
+ return border;
+ }
+ },
"InternalFrame.borderColor", new ColorUIResource(light),
- "InternalFrame.borderDarkShadow", new ColorUIResource(shadow),
- "InternalFrame.borderHighlight", new ColorUIResource(highLight),
- "InternalFrame.borderLight", new ColorUIResource(light),
- "InternalFrame.borderShadow", new ColorUIResource(shadow),
+ "InternalFrame.borderDarkShadow", new ColorUIResource(Color.BLACK),
+ "InternalFrame.borderHighlight", new ColorUIResource(Color.WHITE),
+ "InternalFrame.borderLight", new ColorUIResource(Color.LIGHT_GRAY),
+ "InternalFrame.borderShadow", new ColorUIResource(Color.GRAY),
"InternalFrame.closeIcon", BasicIconFactory.createEmptyFrameIcon(),
- // XXX Don't use gif
-// "InternalFrame.icon", new IconUIResource(new ImageIcon("icons/JavaCup.gif")),
+ // FIXME: Set a nice icon for InternalFrames here.
+ "InternalFrame.icon",
+ new UIDefaults.LazyValue()
+ {
+ public Object createValue(UIDefaults def)
+ {
+ return new IconUIResource(BasicIconFactory.createEmptyFrameIcon());
+ }
+ },
"InternalFrame.iconifyIcon", BasicIconFactory.createEmptyFrameIcon(),
"InternalFrame.inactiveTitleBackground", new ColorUIResource(Color.gray),
"InternalFrame.inactiveTitleForeground",
@@ -500,6 +539,9 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"List.foreground", new ColorUIResource(darkShadow),
"List.selectionBackground", new ColorUIResource(Color.black),
"List.selectionForeground", new ColorUIResource(Color.white),
+ "List.focusCellHighlightBorder",
+ new BorderUIResource.
+ LineBorderUIResource(new ColorUIResource(Color.yellow)),
"Menu.acceleratorFont", new FontUIResource("Dialog", Font.PLAIN, 12),
"Menu.acceleratorForeground", new ColorUIResource(darkShadow),
"Menu.acceleratorSelectionForeground", new ColorUIResource(Color.white),
@@ -625,7 +667,14 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"RadioButton.font", new FontUIResource("Dialog", Font.PLAIN, 12),
"RadioButton.foreground", new ColorUIResource(darkShadow),
"RadioButton.highlight", new ColorUIResource(highLight),
- "RadioButton.icon", BasicIconFactory.getRadioButtonIcon(),
+ "RadioButton.icon",
+ new UIDefaults.LazyValue()
+ {
+ public Object createValue(UIDefaults def)
+ {
+ return BasicIconFactory.getRadioButtonIcon();
+ }
+ },
"RadioButton.light", new ColorUIResource(highLight),
"RadioButton.margin", new InsetsUIResource(2, 2, 2, 2),
"RadioButton.shadow", new ColorUIResource(shadow),
@@ -724,7 +773,7 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"Slider.highlight", new ColorUIResource(highLight),
"Slider.shadow", new ColorUIResource(shadow),
"Slider.thumbHeight", new Integer(20),
- "Slider.thumbWidth", new Integer(10),
+ "Slider.thumbWidth", new Integer(11),
"Slider.tickHeight", new Integer(12),
"Spinner.background", new ColorUIResource(light),
"Spinner.foreground", new ColorUIResource(light),
@@ -826,7 +875,8 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"Table.focusCellBackground", new ColorUIResource(light),
"Table.focusCellForeground", new ColorUIResource(darkShadow),
"Table.focusCellHighlightBorder",
- new BorderUIResource.LineBorderUIResource(Color.white),
+ new BorderUIResource.LineBorderUIResource(
+ new ColorUIResource(255, 255, 0)),
"Table.font", new FontUIResource("Dialog", Font.PLAIN, 12),
"Table.foreground", new ColorUIResource(darkShadow),
"Table.gridColor", new ColorUIResource(Color.gray),
@@ -838,7 +888,7 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"TableHeader.font", new FontUIResource("Dialog", Font.PLAIN, 12),
"TableHeader.foreground", new ColorUIResource(darkShadow),
- "TextArea.background", new ColorUIResource(light),
+ "TextArea.background", new ColorUIResource(light),
"TextArea.border", new BasicBorders.MarginBorder(),
"TextArea.caretBlinkRate", new Integer(500),
"TextArea.caretForeground", new ColorUIResource(Color.black),
@@ -879,11 +929,11 @@ public abstract class BasicLookAndFeel extends LookAndFeel
0),
"notify-field-accept"),
new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT,
- InputEvent.SHIFT_DOWN_MASK),
- "selection-backward"),
+ InputEvent.SHIFT_DOWN_MASK),
+ "selection-backward"),
new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT,
- InputEvent.SHIFT_DOWN_MASK),
- "selection-forward"),
+ InputEvent.SHIFT_DOWN_MASK),
+ "selection-forward"),
},
"TextField.margin", new InsetsUIResource(0, 0, 0, 0),
"TextField.selectionBackground", new ColorUIResource(Color.black),
@@ -1011,20 +1061,18 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"PAGE_UP", "scrollUpChangeSelection",
"ctrl PAGE_DOWN", "scrollDownChangeLead"
}),
- "Tree.font", new FontUIResource("Dialog", Font.PLAIN, 12),
-// "Tree.expandedIcon", new IconUIResource(new ImageIcon("icons/TreeExpanded.png")),
+ "Tree.font", new FontUIResource(new Font("Helvetica", Font.PLAIN, 12)),
"Tree.foreground", new ColorUIResource(Color.black),
- "Tree.hash", new ColorUIResource(Color.gray),
-// "Tree.leafIcon", new IconUIResource(new ImageIcon("icons/TreeLeaf.png")),
+ "Tree.hash", new ColorUIResource(new Color(128, 128, 128)),
"Tree.leftChildIndent", new Integer(7),
-// "Tree.openIcon", new IconUIResource(new ImageIcon("icons/TreeOpen.png")),
"Tree.rightChildIndent", new Integer(13),
- "Tree.rowHeight", new Integer(16),
+ "Tree.rowHeight", new Integer(20), // FIXME
"Tree.scrollsOnExpand", Boolean.TRUE,
"Tree.selectionBackground", new ColorUIResource(Color.black),
+ "Tree.nonSelectionBackground", new ColorUIResource(new Color(239, 235, 231)),
"Tree.selectionBorderColor", new ColorUIResource(Color.black),
- "Tree.selectionForeground", new ColorUIResource(Color.white),
- "Tree.textBackground", new ColorUIResource(Color.white),
+ "Tree.selectionForeground", new ColorUIResource(new Color(255, 255, 255)),
+ "Tree.textBackground", new ColorUIResource(new Color(255, 255, 255)),
"Tree.textForeground", new ColorUIResource(Color.black),
"Viewport.background", new ColorUIResource(light),
"Viewport.foreground", new ColorUIResource(Color.black),