mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-13 07:17:13 -06:00
SplitPane: scale one-touch buttons
This commit is contained in:
@@ -285,15 +285,15 @@ public abstract class FlatLaf
|
|||||||
key.endsWith( "Margins" ) || key.endsWith( "Insets" ) )
|
key.endsWith( "Margins" ) || key.endsWith( "Insets" ) )
|
||||||
return parseInsets( value );
|
return parseInsets( value );
|
||||||
|
|
||||||
// size
|
|
||||||
if( key.endsWith( "Size" ) && !key.equals( "SplitPane.dividerSize" ))
|
|
||||||
return parseSize( value );
|
|
||||||
|
|
||||||
// scaled number
|
// scaled number
|
||||||
ScaledNumber scaledNumber = parseScaledNumber( key, value );
|
ScaledNumber scaledNumber = parseScaledNumber( key, value );
|
||||||
if( scaledNumber != null )
|
if( scaledNumber != null )
|
||||||
return scaledNumber;
|
return scaledNumber;
|
||||||
|
|
||||||
|
// size
|
||||||
|
if( key.endsWith( "Size" ) && !key.equals( "SplitPane.dividerSize" ))
|
||||||
|
return parseSize( value );
|
||||||
|
|
||||||
// width, height
|
// width, height
|
||||||
if( key.endsWith( "Width" ) || key.endsWith( "Height" ) )
|
if( key.endsWith( "Width" ) || key.endsWith( "Height" ) )
|
||||||
return parseInteger( value, true );
|
return parseInteger( value, true );
|
||||||
@@ -400,8 +400,10 @@ public abstract class FlatLaf
|
|||||||
}
|
}
|
||||||
|
|
||||||
private ScaledNumber parseScaledNumber( String key, String value ) {
|
private ScaledNumber parseScaledNumber( String key, String value ) {
|
||||||
if( !key.equals( "OptionPane.buttonMinimumWidth" ) )
|
if( !key.equals( "OptionPane.buttonMinimumWidth" ) &&
|
||||||
return null; // not supported
|
!key.equals( "SplitPane.oneTouchButtonSize" ) &&
|
||||||
|
!key.equals( "SplitPane.oneTouchButtonOffset" ) )
|
||||||
|
return null; // not supported
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return new ScaledNumber( Integer.parseInt( value ) );
|
return new ScaledNumber( Integer.parseInt( value ) );
|
||||||
|
|||||||
@@ -126,8 +126,16 @@ public class FlatArrowButton
|
|||||||
|
|
||||||
int w = scale( chevron ? 8 : 9 );
|
int w = scale( chevron ? 8 : 9 );
|
||||||
int h = scale( chevron ? 4 : 5 );
|
int h = scale( chevron ? 4 : 5 );
|
||||||
int x = Math.round( (width - (vert ? w : h)) / 2f + scale( (float) xOffset ) );
|
int rw = vert ? w : h;
|
||||||
int y = Math.round( (height - (vert ? h : w)) / 2f + scale( (float) yOffset ) );
|
int rh = vert ? h : w;
|
||||||
|
int x = Math.round( (width - rw) / 2f + scale( (float) xOffset ) );
|
||||||
|
int y = Math.round( (height - rh) / 2f + scale( (float) yOffset ) );
|
||||||
|
|
||||||
|
// optimization for small chevron arrows (e.g. OneTouchButtons in SplitPane)
|
||||||
|
if( x + rw >= width && x > 0 )
|
||||||
|
x--;
|
||||||
|
if( y + rh >= height && y > 0 )
|
||||||
|
y--;
|
||||||
|
|
||||||
// paint arrow
|
// paint arrow
|
||||||
g.setColor( enabled
|
g.setColor( enabled
|
||||||
|
|||||||
@@ -307,6 +307,8 @@ SplitPane.dividerSize=5
|
|||||||
SplitPane.continuousLayout=true
|
SplitPane.continuousLayout=true
|
||||||
SplitPane.border=null
|
SplitPane.border=null
|
||||||
SplitPane.centerOneTouchButtons=true
|
SplitPane.centerOneTouchButtons=true
|
||||||
|
SplitPane.oneTouchButtonSize=6
|
||||||
|
SplitPane.oneTouchButtonOffset=2
|
||||||
|
|
||||||
SplitPaneDivider.border=null
|
SplitPaneDivider.border=null
|
||||||
SplitPaneDivider.oneTouchArrowColor=@@ComboBox.buttonArrowColor
|
SplitPaneDivider.oneTouchArrowColor=@@ComboBox.buttonArrowColor
|
||||||
|
|||||||
Reference in New Issue
Block a user