mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-13 07:17:13 -06:00
Window decorations: added option to show window icon only in frames, but not in dialogs (issue #589)
This commit is contained in:
@@ -55,6 +55,7 @@ import javax.swing.BoxLayout;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JMenuBar;
|
||||
import javax.swing.JPanel;
|
||||
@@ -80,6 +81,7 @@ import com.formdev.flatlaf.util.UIScale;
|
||||
* @uiDefault TitlePane.borderColor Color optional
|
||||
* @uiDefault TitlePane.unifiedBackground boolean
|
||||
* @uiDefault TitlePane.showIcon boolean
|
||||
* @uiDefault TitlePane.showIconInDialogs boolean
|
||||
* @uiDefault TitlePane.noIconLeftGap int
|
||||
* @uiDefault TitlePane.iconSize Dimension
|
||||
* @uiDefault TitlePane.iconMargins Insets
|
||||
@@ -111,6 +113,7 @@ public class FlatTitlePane
|
||||
protected final Color borderColor = UIManager.getColor( "TitlePane.borderColor" );
|
||||
|
||||
/** @since 2 */ protected final boolean showIcon = FlatUIUtils.getUIBoolean( "TitlePane.showIcon", true );
|
||||
/** @since 2.5 */ protected final boolean showIconInDialogs = FlatUIUtils.getUIBoolean( "TitlePane.showIconInDialogs", true );
|
||||
/** @since 2 */ protected final int noIconLeftGap = FlatUIUtils.getUIInt( "TitlePane.noIconLeftGap", 8 );
|
||||
protected final Dimension iconSize = UIManager.getDimension( "TitlePane.iconSize" );
|
||||
/** @since 2.4 */ protected final int titleMinimumWidth = FlatUIUtils.getUIInt( "TitlePane.titleMinimumWidth", 60 );
|
||||
@@ -389,9 +392,13 @@ public class FlatTitlePane
|
||||
}
|
||||
|
||||
protected void updateIcon() {
|
||||
boolean defaultShowIcon = showIcon;
|
||||
if( !showIconInDialogs && rootPane.getParent() instanceof JDialog )
|
||||
defaultShowIcon = false;
|
||||
|
||||
// get window images
|
||||
List<Image> images = null;
|
||||
if( clientPropertyBoolean( rootPane, TITLE_BAR_SHOW_ICON, showIcon ) ) {
|
||||
if( clientPropertyBoolean( rootPane, TITLE_BAR_SHOW_ICON, defaultShowIcon ) ) {
|
||||
images = window.getIconImages();
|
||||
if( images.isEmpty() ) {
|
||||
// search in owners
|
||||
|
||||
@@ -785,6 +785,7 @@ TitlePane.useWindowDecorations = true
|
||||
TitlePane.menuBarEmbedded = true
|
||||
TitlePane.unifiedBackground = true
|
||||
TitlePane.showIcon = true
|
||||
TitlePane.showIconInDialogs = true
|
||||
TitlePane.noIconLeftGap = 8
|
||||
TitlePane.iconSize = 16,16
|
||||
TitlePane.iconMargins = 3,8,3,8
|
||||
|
||||
Reference in New Issue
Block a user