summaryrefslogtreecommitdiff
path: root/libjava/classpath/javax/swing/plaf/metal/MetalScrollBarUI.java
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/classpath/javax/swing/plaf/metal/MetalScrollBarUI.java')
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalScrollBarUI.java86
1 files changed, 70 insertions, 16 deletions
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalScrollBarUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalScrollBarUI.java
index 155bb814689..c7dfd11e48c 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalScrollBarUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalScrollBarUI.java
@@ -349,10 +349,15 @@ public class MetalScrollBarUI extends BasicScrollBarUI
else
paintThumbVertical(g, c, thumbBounds);
- // draw the pattern
- MetalUtils.fillMetalPattern(c, g, thumbBounds.x + 3, thumbBounds.y + 3,
- thumbBounds.width - 6, thumbBounds.height - 6,
- thumbHighlightColor, thumbLightShadowColor);
+ // Draw the pattern when the theme is not Ocean.
+ if (! (MetalLookAndFeel.getCurrentTheme() instanceof OceanTheme))
+ {
+ MetalUtils.fillMetalPattern(c, g, thumbBounds.x + 3, thumbBounds.y + 3,
+ thumbBounds.width - 6,
+ thumbBounds.height - 6,
+ thumbHighlightColor,
+ thumbLightShadowColor);
+ }
}
/**
@@ -370,13 +375,24 @@ public class MetalScrollBarUI extends BasicScrollBarUI
int w = thumbBounds.width;
int h = thumbBounds.height;
- // first we fill the background
- g.setColor(thumbColor);
- if (isFreeStanding)
- g.fillRect(x, y, w, h - 1);
+ // First we fill the background.
+ MetalTheme theme = MetalLookAndFeel.getCurrentTheme();
+ if (theme instanceof OceanTheme
+ && UIManager.get("ScrollBar.gradient") != null)
+ {
+ MetalUtils.paintGradient(g, x + 2, y + 2, w - 4, h - 2,
+ SwingConstants.VERTICAL,
+ "ScrollBar.gradient");
+ }
else
- g.fillRect(x, y, w, h);
-
+ {
+ g.setColor(thumbColor);
+ if (isFreeStanding)
+ g.fillRect(x, y, w, h - 1);
+ else
+ g.fillRect(x, y, w, h);
+ }
+
// then draw the dark box
g.setColor(thumbLightShadowColor);
if (isFreeStanding)
@@ -405,6 +421,19 @@ public class MetalScrollBarUI extends BasicScrollBarUI
g.setColor(UIManager.getColor("ScrollBar.shadow"));
g.drawLine(x + w, y + 1, x + w, y + h - 1);
+ // For the OceanTheme, draw the 3 lines in the middle.
+ if (theme instanceof OceanTheme)
+ {
+ g.setColor(thumbLightShadowColor);
+ int middle = x + w / 2;
+ g.drawLine(middle - 2, y + 4, middle - 2, y + h - 5);
+ g.drawLine(middle, y + 4, middle, y + h - 5);
+ g.drawLine(middle + 2, y + 4, middle + 2, y + h - 5);
+ g.setColor(UIManager.getColor("ScrollBar.highlight"));
+ g.drawLine(middle - 1, y + 5, middle - 1, y + h - 4);
+ g.drawLine(middle + 1, y + 5, middle + 1, y + h - 4);
+ g.drawLine(middle + 3, y + 5, middle + 3, y + h - 4);
+ }
}
/**
@@ -422,13 +451,24 @@ public class MetalScrollBarUI extends BasicScrollBarUI
int w = thumbBounds.width;
int h = thumbBounds.height;
- // first we fill the background
- g.setColor(thumbColor);
- if (isFreeStanding)
- g.fillRect(x, y, w - 1, h);
+ // First we fill the background.
+ MetalTheme theme = MetalLookAndFeel.getCurrentTheme();
+ if (theme instanceof OceanTheme
+ && UIManager.get("ScrollBar.gradient") != null)
+ {
+ MetalUtils.paintGradient(g, x + 2, y + 2, w - 2, h - 4,
+ SwingConstants.HORIZONTAL,
+ "ScrollBar.gradient");
+ }
else
- g.fillRect(x, y, w, h);
-
+ {
+ g.setColor(thumbColor);
+ if (isFreeStanding)
+ g.fillRect(x, y, w - 1, h);
+ else
+ g.fillRect(x, y, w, h);
+ }
+
// then draw the dark box
g.setColor(thumbLightShadowColor);
if (isFreeStanding)
@@ -456,6 +496,20 @@ public class MetalScrollBarUI extends BasicScrollBarUI
// draw the shadow line
g.setColor(UIManager.getColor("ScrollBar.shadow"));
g.drawLine(x + 1, y + h, x + w - 2, y + h);
+
+ // For the OceanTheme, draw the 3 lines in the middle.
+ if (theme instanceof OceanTheme)
+ {
+ g.setColor(thumbLightShadowColor);
+ int middle = y + h / 2;
+ g.drawLine(x + 4, middle - 2, x + w - 5, middle - 2);
+ g.drawLine(x + 4, middle, x + w - 5, middle);
+ g.drawLine(x + 4, middle + 2, x + w - 5, middle + 2);
+ g.setColor(UIManager.getColor("ScrollBar.highlight"));
+ g.drawLine(x + 5, middle - 1, x + w - 4, middle - 1);
+ g.drawLine(x + 5, middle + 1, x + w - 4, middle + 1);
+ g.drawLine(x + 5, middle + 3, x + w - 4, middle + 3);
+ }
}
/**