JScrollBar Triangle Color?
Hello developers!
I am losing my head over this issue.
I don't seem to be able to style the triangle (arrow) in a scrollbar.
This is my code to style all the rest of the components:
import java.awt.*;
import javax.swing.*;
import javax.swing.plaf.basic.*;
publicclass ScrollBarUIextends BasicScrollBarUI{
public ScrollBarUI(){
}
public JButton createIncreaseButton(int orientation){
JButton btn = super.createIncreaseButton(orientation);
btn.setBackground(Color.BLACK);
btn.setBorder(BorderFactory.createLineBorder(Color.WHITE, 1));
return btn;
}
public JButton createDecreaseButton(int orientation){
JButton btn = super.createDecreaseButton(orientation);
btn.setBackground(Color.BLACK);
btn.setBorder(BorderFactory.createLineBorder(Color.WHITE, 1));
return btn;
}
publicvoid paintThumb(Graphics g,JComponent c, Rectangle thumbBounds){
g.setColor(Color.BLACK);
g.fillRoundRect((int)thumbBounds.getX(),(int)thumbBounds.getY(),
(int)thumbBounds.getWidth(),(int)thumbBounds.getHeight(), 5, 5);
}
publicvoid paintTrack(Graphics g,JComponent c,Rectangle trackBounds){
g.setColor(Color.WHITE);
g.fillRect((int)trackBounds.getX(),(int)trackBounds.getY(),
(int)trackBounds.getWidth(),(int)trackBounds.getHeight());
}
}
If anybody has a solution I would be very gratefull,
Stanny
[2629 byte] By [
Stannya] at [2007-11-27 8:19:55]

Trying using the UIManager, maybe one of these will help...note that the ones that are Colors or ColorUIResource can be set to a Color. I'm guessing its the thumb ones.
ScrollBar.actionMap,class javax.swing.plaf.basic.LazyActionMap
ScrollBar.allowsAbsolutePositioning,class java.lang.Boolean
ScrollBar.ancestorInputMap,class javax.swing.plaf.InputMapUIResource
ScrollBar.ancestorInputMap.RightToLeft,class javax.swing.plaf.InputMapUIResource
ScrollBar.background,class javax.swing.plaf.ColorUIResource
ScrollBar.darkShadow,class javax.swing.plaf.ColorUIResource
ScrollBar.foreground,class java.awt.Color
ScrollBar.gradient,class java.util.Arrays$ArrayList
ScrollBar.highlight,class javax.swing.plaf.ColorUIResource
ScrollBar.maximumThumbSize,class javax.swing.plaf.DimensionUIResource
ScrollBar.minimumThumbSize,class javax.swing.plaf.DimensionUIResource
ScrollBar.shadow,class javax.swing.plaf.ColorUIResource
ScrollBar.thumb,class javax.swing.plaf.ColorUIResource
ScrollBar.thumbDarkShadow,class javax.swing.plaf.ColorUIResource
ScrollBar.thumbHighlight,class javax.swing.plaf.ColorUIResource
ScrollBar.thumbShadow,class javax.swing.plaf.ColorUIResource
ScrollBar.track,class javax.swing.plaf.ColorUIResource
ScrollBar.trackHighlight,class javax.swing.plaf.ColorUIResource
ScrollBar.width,class java.lang.Integer
ScrollBarUI,class java.lang.String
ScrollPane.actionMap,class javax.swing.plaf.basic.LazyActionMap
ScrollPane.ancestorInputMap,class javax.swing.plaf.InputMapUIResource
ScrollPane.ancestorInputMap.RightToLeft,class javax.swing.plaf.InputMapUIResource
ScrollPane.background,class javax.swing.plaf.ColorUIResource
ScrollPane.border,class javax.swing.plaf.metal.MetalBorders$ScrollPaneBorder
ScrollPane.font,class javax.swing.plaf.FontUIResource
ScrollPane.foreground,class sun.swing.PrintColorUIResource
ScrollPaneUI,class java.lang.String