mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-11 06:27:13 -06:00
InternalFrame: made buttons larger and square (issue #39)
This commit is contained in:
@@ -18,6 +18,7 @@ package com.formdev.flatlaf.icons;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import javax.swing.UIManager;
|
||||
import com.formdev.flatlaf.ui.FlatButtonUI;
|
||||
@@ -28,7 +29,6 @@ import com.formdev.flatlaf.ui.FlatUIUtils;
|
||||
*
|
||||
* @uiDefault InternalFrame.buttonHoverBackground Color
|
||||
* @uiDefault InternalFrame.buttonPressedBackground Color
|
||||
* @uiDefault Button.arc int
|
||||
*
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
@@ -37,15 +37,15 @@ public abstract class FlatInternalFrameAbstractIcon
|
||||
{
|
||||
private final Color hoverBackground;
|
||||
private final Color pressedBackground;
|
||||
private final int arc = UIManager.getInt( "Button.arc" );
|
||||
|
||||
public FlatInternalFrameAbstractIcon() {
|
||||
this( UIManager.getColor( "InternalFrame.buttonHoverBackground" ),
|
||||
this( UIManager.getDimension( "InternalFrame.buttonSize" ),
|
||||
UIManager.getColor( "InternalFrame.buttonHoverBackground" ),
|
||||
UIManager.getColor( "InternalFrame.buttonPressedBackground" ) );
|
||||
}
|
||||
|
||||
public FlatInternalFrameAbstractIcon( Color hoverBackground, Color pressedBackground ) {
|
||||
super( 16, 16, null );
|
||||
public FlatInternalFrameAbstractIcon( Dimension size, Color hoverBackground, Color pressedBackground ) {
|
||||
super( size.width, size.height, null );
|
||||
this.hoverBackground = hoverBackground;
|
||||
this.pressedBackground = pressedBackground;
|
||||
}
|
||||
@@ -54,7 +54,7 @@ public abstract class FlatInternalFrameAbstractIcon
|
||||
Color background = FlatButtonUI.buttonStateColor( c, null, null, null, hoverBackground, pressedBackground );
|
||||
if( background != null ) {
|
||||
FlatUIUtils.setColor( g, background, c.getBackground() );
|
||||
g.fillRoundRect( 0, 0, width, height, arc, arc );
|
||||
g.fillRect( 0, 0, width, height );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,8 @@ public class FlatInternalFrameCloseIcon
|
||||
private final Color pressedForeground = UIManager.getColor( "InternalFrame.closePressedForeground" );
|
||||
|
||||
public FlatInternalFrameCloseIcon() {
|
||||
super( UIManager.getColor( "InternalFrame.closeHoverBackground" ),
|
||||
super( UIManager.getDimension( "InternalFrame.buttonSize" ),
|
||||
UIManager.getColor( "InternalFrame.closeHoverBackground" ),
|
||||
UIManager.getColor( "InternalFrame.closePressedBackground" ) );
|
||||
}
|
||||
|
||||
@@ -50,8 +51,8 @@ public class FlatInternalFrameCloseIcon
|
||||
|
||||
g.setColor( FlatButtonUI.buttonStateColor( c, null, null, null, hoverForeground, pressedForeground ) );
|
||||
|
||||
float mx = 8;
|
||||
float my = 8;
|
||||
float mx = width / 2;
|
||||
float my = height / 2;
|
||||
float r = 3.25f;
|
||||
|
||||
Path2D path = new Path2D.Float( Path2D.WIND_EVEN_ODD );
|
||||
|
||||
@@ -35,6 +35,6 @@ public class FlatInternalFrameIconifyIcon
|
||||
paintBackground( c, g );
|
||||
|
||||
g.setColor( c.getForeground() );
|
||||
g.fillRect( 4, 8, 8, 1 );
|
||||
g.fillRect( (width / 2) - 4, height / 2, 8, 1 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,6 @@ public class FlatInternalFrameMaximizeIcon
|
||||
paintBackground( c, g );
|
||||
|
||||
g.setColor( c.getForeground() );
|
||||
g.fill( FlatUIUtils.createRectangle( 4, 4, 8, 8, 1 ) );
|
||||
g.fill( FlatUIUtils.createRectangle( (width / 2) - 4, (height / 2) - 4, 8, 8, 1 ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,11 +40,13 @@ public class FlatInternalFrameMinimizeIcon
|
||||
|
||||
g.setColor( c.getForeground() );
|
||||
|
||||
Path2D r1 = FlatUIUtils.createRectangle( 5, 3, 8, 8, 1 );
|
||||
Path2D r2 = FlatUIUtils.createRectangle( 3, 5, 8, 8, 1 );
|
||||
int x = (width / 2) - 4;
|
||||
int y = (height / 2) - 4;
|
||||
Path2D r1 = FlatUIUtils.createRectangle( x + 1, y - 1, 8, 8, 1 );
|
||||
Path2D r2 = FlatUIUtils.createRectangle( x - 1, y + 1, 8, 8, 1 );
|
||||
|
||||
Area area = new Area( r1 );
|
||||
area.subtract( new Area( new Rectangle2D.Float( 3, 5, 8, 8 ) ) );
|
||||
area.subtract( new Area( new Rectangle2D.Float( x - 1, y + 1, 8, 8 ) ) );
|
||||
g.fill( area );
|
||||
|
||||
g.fill( r2 );
|
||||
|
||||
@@ -50,9 +50,10 @@ public class FlatEmptyBorder
|
||||
|
||||
@Override
|
||||
public Insets getBorderInsets( Component c, Insets insets ) {
|
||||
insets.left = scale( left );
|
||||
boolean leftToRight = left == right || c.getComponentOrientation().isLeftToRight();
|
||||
insets.left = scale( leftToRight ? left : right );
|
||||
insets.top = scale( top );
|
||||
insets.right = scale( right );
|
||||
insets.right = scale( leftToRight ? right : left );
|
||||
insets.bottom = scale( bottom );
|
||||
return insets;
|
||||
}
|
||||
|
||||
@@ -205,6 +205,7 @@ HelpButton.disabledQuestionMarkColor=$CheckBox.icon.disabledCheckmarkColor
|
||||
InternalFrame.border=com.formdev.flatlaf.ui.FlatInternalFrameUI$FlatInternalFrameBorder
|
||||
InternalFrame.borderLineWidth=1
|
||||
InternalFrame.borderMargins=6,6,6,6
|
||||
InternalFrame.buttonSize=24,24
|
||||
InternalFrame.closeIcon=com.formdev.flatlaf.icons.FlatInternalFrameCloseIcon
|
||||
InternalFrame.iconifyIcon=com.formdev.flatlaf.icons.FlatInternalFrameIconifyIcon
|
||||
InternalFrame.maximizeIcon=com.formdev.flatlaf.icons.FlatInternalFrameMaximizeIcon
|
||||
@@ -213,7 +214,7 @@ InternalFrame.minimizeIcon=com.formdev.flatlaf.icons.FlatInternalFrameMinimizeIc
|
||||
|
||||
#---- InternalFrameTitlePane ----
|
||||
|
||||
InternalFrameTitlePane.border=4,8,4,4
|
||||
InternalFrameTitlePane.border=0,8,0,0
|
||||
|
||||
|
||||
#---- List ----
|
||||
|
||||
@@ -150,7 +150,7 @@ InternalFrame.inactiveTitleForeground=#afa
|
||||
InternalFrame.activeBorderColor=#f00
|
||||
InternalFrame.inactiveBorderColor=#0f0
|
||||
|
||||
InternalFrame.buttonHoverBackground=#080
|
||||
InternalFrame.buttonHoverBackground=#060
|
||||
InternalFrame.buttonPressedBackground=#0a0
|
||||
InternalFrame.closeHoverBackground=#008
|
||||
InternalFrame.closePressedBackground=#00f
|
||||
|
||||
Reference in New Issue
Block a user