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