summaryrefslogtreecommitdiff
path: root/javax/swing/plaf/basic/BasicToolBarUI.java
diff options
context:
space:
mode:
Diffstat (limited to 'javax/swing/plaf/basic/BasicToolBarUI.java')
-rw-r--r--javax/swing/plaf/basic/BasicToolBarUI.java68
1 files changed, 45 insertions, 23 deletions
diff --git a/javax/swing/plaf/basic/BasicToolBarUI.java b/javax/swing/plaf/basic/BasicToolBarUI.java
index 80fec6a77..eabac1570 100644
--- a/javax/swing/plaf/basic/BasicToolBarUI.java
+++ b/javax/swing/plaf/basic/BasicToolBarUI.java
@@ -1,5 +1,5 @@
/* BasicToolBarUI.java --
- Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -75,11 +75,12 @@ import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.border.Border;
-import javax.swing.border.EtchedBorder;
+import javax.swing.border.CompoundBorder;
import javax.swing.event.MouseInputListener;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.ToolBarUI;
import javax.swing.plaf.UIResource;
+import javax.swing.plaf.basic.BasicBorders.ButtonBorder;
/**
* This is the Basic Look and Feel UI class for JToolBar.
@@ -310,8 +311,19 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
*/
protected Border createNonRolloverBorder()
{
- return new EtchedBorder();
- }
+ Border b = UIManager.getBorder("ToolBar.nonrolloverBorder");
+
+ if (b == null)
+ {
+ b = new CompoundBorder(
+ new ButtonBorder(UIManager.getColor("Button.shadow"),
+ UIManager.getColor("Button.darkShadow"),
+ UIManager.getColor("Button.light"),
+ UIManager.getColor("Button.highlight")),
+ BasicBorders.getMarginBorder());
+ }
+
+ return b; }
/**
* This method creates a new PropertyChangeListener for the JToolBar.
@@ -331,18 +343,19 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
*/
protected Border createRolloverBorder()
{
- return new EtchedBorder()
+ Border b = UIManager.getBorder("ToolBar.rolloverBorder");
+
+ if (b == null)
{
- public void paintBorder(Component c, Graphics g, int x, int y,
- int width, int height)
- {
- if (c instanceof JButton)
- {
- if (((JButton) c).getModel().isRollover())
- super.paintBorder(c, g, x, y, width, height);
- }
- }
- };
+ b = new CompoundBorder(
+ new ButtonBorder(UIManager.getColor("Button.shadow"),
+ UIManager.getColor("Button.darkShadow"),
+ UIManager.getColor("Button.light"),
+ UIManager.getColor("Button.highlight")),
+ BasicBorders.getMarginBorder());
+ }
+
+ return b;
}
/**
@@ -745,6 +758,7 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
* @param direction The direction to give focus to.
*/
protected void navigateFocusedComp(int direction)
+ throws NotImplementedException
{
// FIXME: Implement.
}
@@ -761,6 +775,10 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
{
AbstractButton b = (AbstractButton) c;
b.setRolloverEnabled(false);
+
+ // Save old border in hashtable.
+ borders.put(b, b.getBorder());
+
b.setBorder(nonRolloverBorder);
}
}
@@ -772,11 +790,11 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
*/
protected void setBorderToNormal(Component c)
{
- if (c instanceof JButton)
+ if (c instanceof AbstractButton)
{
- JButton b = (JButton) c;
- Border border = (Border) borders.get(b);
- b.setBorder(border);
+ AbstractButton b = (AbstractButton) c;
+ b.setRolloverEnabled(true);
+ b.setBorder((Border) borders.remove(b));
}
}
@@ -787,11 +805,15 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
*/
protected void setBorderToRollover(Component c)
{
- if (c instanceof JButton)
+ if (c instanceof AbstractButton)
{
- JButton b = (JButton) c;
- b.setRolloverEnabled(true);
- b.setBorder(rolloverBorder);
+ AbstractButton b = (AbstractButton) c;
+ b.setRolloverEnabled(false);
+
+ // Save old border in hashtable.
+ borders.put(b, b.getBorder());
+
+ b.setBorder(rolloverBorder);
}
}