-
-
Notifications
You must be signed in to change notification settings - Fork 280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How can I decorate the scroll bar? #103
Comments
Don't know what you mean. If you want arrow buttons or wider scroll bars, see: |
You can subclass Here is a working example that paints round thumbs: public class MyFlatScrollBarUI
extends FlatScrollBarUI
{
public static ComponentUI createUI( JComponent c ) {
return new MyFlatScrollBarUI();
}
@Override
protected void paintThumb( Graphics g, JComponent c, Rectangle thumbBounds ) {
if( thumbBounds.isEmpty() || !scrollbar.isEnabled() )
return;
FlatUIUtils.setRenderingHints( (Graphics2D) g );
int arc = Math.min( c.getWidth(), c.getHeight() ) - 2;
g.setColor( thumbColor );
g.fillRoundRect( thumbBounds.x + 1, thumbBounds.y + 1, thumbBounds.width - 2, thumbBounds.height - 2, arc, arc );
}
} Unfortunately it is currently not possible to paint the thumb in a darker color when the mouse is over it because the hover field is private. I'll change that for the next version. Then register the class in UIManager.put( "ScrollBarUI", "com.myproject.MyFlatScrollBarUI" ); Anyway, I'm open to support different scrollbar styles out of the box. |
…ubclasses implement own painting (issue #103)
Thanks, DevCharly. |
…se they are given for vertical orientation (issue #103)
Since FlatLaf 0.36 it is possible to use different styles for scroll bars. |
Hi JFormDesigner,
I wanted to know how can I decorate the scroll bar.
The text was updated successfully, but these errors were encountered: