mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-06 22:10:54 +03:00
Window decorations: added UI value TitlePane.font to customize window title font (issue #589)
This commit is contained in:
@@ -21,6 +21,7 @@ FlatLaf Change Log
|
||||
(allow moving window). (issue #569)
|
||||
- Option to show window icon only in frames, but not in dialogs. Set UI value
|
||||
`TitlePane.showIconInDialogs` to `false`. (issue #589)
|
||||
- Added UI value `TitlePane.font` to customize window title font. (issue #589)
|
||||
- Added system property `flatlaf.updateUIOnSystemFontChange` to allow disabling
|
||||
automatic UI update when system font changes. (issue #580)
|
||||
|
||||
|
||||
@@ -581,6 +581,7 @@ public abstract class FlatLaf
|
||||
|
||||
// add fonts that are not set in BasicLookAndFeel
|
||||
defaults.put( "RootPane.font", activeFont );
|
||||
defaults.put( "TitlePane.font", activeFont );
|
||||
}
|
||||
|
||||
private void initDefaultFont( UIDefaults defaults ) {
|
||||
|
||||
@@ -24,6 +24,7 @@ import java.awt.Container;
|
||||
import java.awt.Dialog;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.EventQueue;
|
||||
import java.awt.Font;
|
||||
import java.awt.FontMetrics;
|
||||
import java.awt.Frame;
|
||||
import java.awt.Graphics;
|
||||
@@ -73,6 +74,7 @@ import com.formdev.flatlaf.util.UIScale;
|
||||
/**
|
||||
* Provides the Flat LaF title bar.
|
||||
*
|
||||
* @uiDefault TitlePane.font Font
|
||||
* @uiDefault TitlePane.background Color
|
||||
* @uiDefault TitlePane.inactiveBackground Color
|
||||
* @uiDefault TitlePane.foreground Color
|
||||
@@ -105,6 +107,7 @@ import com.formdev.flatlaf.util.UIScale;
|
||||
public class FlatTitlePane
|
||||
extends JComponent
|
||||
{
|
||||
/** @since 2.5 */ protected final Font titleFont = UIManager.getFont( "TitlePane.font" );
|
||||
protected final Color activeBackground = UIManager.getColor( "TitlePane.background" );
|
||||
protected final Color inactiveBackground = UIManager.getColor( "TitlePane.inactiveBackground" );
|
||||
protected final Color activeForeground = UIManager.getColor( "TitlePane.foreground" );
|
||||
@@ -1012,6 +1015,14 @@ debug*/
|
||||
super( false );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void installDefaults( JLabel c ) {
|
||||
super.installDefaults( c );
|
||||
|
||||
if( titleFont != null )
|
||||
c.setFont( titleFont );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String layoutCL( JLabel label, FontMetrics fontMetrics, String text, Icon icon,
|
||||
Rectangle viewR, Rectangle iconR, Rectangle textR )
|
||||
|
||||
@@ -1226,6 +1226,7 @@ TitlePane.closeIcon [lazy] 44,30 com.formdev.flatlaf.icons.FlatWin
|
||||
TitlePane.closePressedBackground #c42b1ce6 90% HSLA 5 75 44 90 javax.swing.plaf.ColorUIResource [UI]
|
||||
TitlePane.closePressedForeground #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI]
|
||||
TitlePane.embeddedForeground #959595 HSL 0 0 58 javax.swing.plaf.ColorUIResource [UI]
|
||||
TitlePane.font [active] $defaultFont [UI]
|
||||
TitlePane.foreground #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI]
|
||||
TitlePane.icon [lazy] 16,16 sun.swing.ImageIconUIResource [UI] (sun.awt.image.ToolkitImage)
|
||||
TitlePane.iconMargins 3,8,3,8 javax.swing.plaf.InsetsUIResource [UI]
|
||||
|
||||
@@ -1231,6 +1231,7 @@ TitlePane.closeIcon [lazy] 44,30 com.formdev.flatlaf.icons.FlatWin
|
||||
TitlePane.closePressedBackground #c42b1ce6 90% HSLA 5 75 44 90 javax.swing.plaf.ColorUIResource [UI]
|
||||
TitlePane.closePressedForeground #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI]
|
||||
TitlePane.embeddedForeground #595959 HSL 0 0 35 javax.swing.plaf.ColorUIResource [UI]
|
||||
TitlePane.font [active] $defaultFont [UI]
|
||||
TitlePane.foreground #000000 HSL 0 0 0 javax.swing.plaf.ColorUIResource [UI]
|
||||
TitlePane.icon [lazy] 16,16 sun.swing.ImageIconUIResource [UI] (sun.awt.image.ToolkitImage)
|
||||
TitlePane.iconMargins 3,8,3,8 javax.swing.plaf.InsetsUIResource [UI]
|
||||
|
||||
@@ -1259,6 +1259,7 @@ TitlePane.closeHoverForeground #ffffff HSL 0 0 100 javax.swing.plaf.Colo
|
||||
TitlePane.closeIcon [lazy] 44,30 com.formdev.flatlaf.icons.FlatWindowCloseIcon [UI]
|
||||
TitlePane.closePressedBackground #c42b1ce6 90% HSLA 5 75 44 90 javax.swing.plaf.ColorUIResource [UI]
|
||||
TitlePane.closePressedForeground #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI]
|
||||
TitlePane.font [active] $defaultFont [UI]
|
||||
TitlePane.foreground #0000ff HSL 240 100 50 javax.swing.plaf.ColorUIResource [UI]
|
||||
TitlePane.icon [lazy] 16,16 sun.swing.ImageIconUIResource [UI] (sun.awt.image.ToolkitImage)
|
||||
TitlePane.iconMargins 3,8,3,8 javax.swing.plaf.InsetsUIResource [UI]
|
||||
|
||||
@@ -996,6 +996,7 @@ TitlePane.closeIcon
|
||||
TitlePane.closePressedBackground
|
||||
TitlePane.closePressedForeground
|
||||
TitlePane.embeddedForeground
|
||||
TitlePane.font
|
||||
TitlePane.foreground
|
||||
TitlePane.icon
|
||||
TitlePane.iconMargins
|
||||
|
||||
Reference in New Issue
Block a user