-
-
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
JPanel Rounded Corners #367
Comments
FlatLineBorder: support rounded corners
implemented in main branch for v2 There are several ways to use it. Set panel background color and arc diameter: panel.setBackground( Color.magenta );
panel.putClientProperty( FlatClientProperties.STYLE, "arc: 8" ); Use panel.setBackground( Color.magenta );
panel.setBorder( new FlatLineBorder( new Insets( 16, 16, 16, 16 ), Color.blue, 1, 8 ) ); Or use styling and let FlatLaf compute colors: panel.putClientProperty( FlatClientProperties.STYLE,
"background: tint(@background,50%);" +
"border: 16,16,16,16,shade(@background,10%),,8" ); To support light and dark themes: panel.putClientProperty( FlatClientProperties.STYLE,
"[light]background: tint(@background,50%);" +
"[dark]background: shade(@background,15%);" +
"[light]border: 16,16,16,16,shade(@background,10%),,8;" +
"[dark]border: 16,16,16,16,tint(@background,10%),,8" ); If you have many places to use same panel style, define it once (after UIManager.put( "[style]Panel.myRoundPanel",
"[light]background: tint(@background,50%);" +
"[dark]background: shade(@background,15%);" +
"[light]border: 16,16,16,16,shade(@background,10%),,8;" +
"[dark]border: 16,16,16,16,tint(@background,10%),,8" ); and use it: panel.putClientProperty( FlatClientProperties.STYLE_CLASS, "myRoundPanel" ); Or use own FlatLaf properties files to define such styles. Create
And create
|
How to apply gradient color on a Jpanel with FlatLaf? |
@Langelot0210 FlatLaf does not support gradient backgrounds. You have to implement this yourself. |
It is great JPanel have rounded property like other components as well...
Thanks for such amazing LAF.
The text was updated successfully, but these errors were encountered: