1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
| class MyScrollBarUI extends BasicScrollBarUI
{
// this draws scroller
protected void paintThumb(Graphics g, JComponent c, Rectangle thumbBounds)
{
g.setColor(ColorConf.STATIC_COLOR);
g.fillRoundRect((int)thumbBounds.getX(),(int)thumbBounds.getY(),
(int)thumbBounds.getWidth(),(int)thumbBounds.getHeight(), 30, 30);
g.setColor(Color.WHITE);
g.drawRoundRect((int)thumbBounds.getX(),(int)thumbBounds.getY(),
(int)thumbBounds.getWidth(),(int)thumbBounds.getHeight(), 30, 30);
}
// this draws scroller background
protected void paintTrack(Graphics g, JComponent c, Rectangle trackBounds)
{
g.setColor(ColorConf.BACKGROUND_COLOR);
g.fill3DRect((int)trackBounds.getX(),(int)trackBounds.getY(),
(int)trackBounds.getWidth(),(int)trackBounds.getHeight(),true);
}
// and methods creating scrollbar buttons
protected JButton createDecreaseButton(int orientation)
{
return new BasicArrowButton(orientation,
ColorConf.STATIC_COLOR,
Color.white,
Color.white,
Color.white){
public Dimension getPreferredSize(){
return new Dimension(35,35);
}
};
}
protected JButton createIncreaseButton(int orientation)
{
return new BasicArrowButton(orientation,
ColorConf.STATIC_COLOR,
Color.white,
Color.white,
Color.white){
public Dimension getPreferredSize(){
return new Dimension(35,35);
}
};
}
} |
Partager