mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-11 06:27:13 -06:00
Menus: changed menu bar and popup menu background colors (made brighter in light themes and darker in dark themes)
made `JMenu`, `JMenuItem`, `JCheckBoxMenuItem` and `JRadioButtonMenuItem` non-opaque
This commit is contained in:
@@ -3,6 +3,12 @@ FlatLaf Change Log
|
||||
|
||||
## Unreleased
|
||||
|
||||
- Menus:
|
||||
- Changed menu bar and popup menu background colors (made brighter in light
|
||||
themes and darker in dark themes).
|
||||
- Popup menus now have empty space at the top and bottom.
|
||||
- Made `JMenu`, `JMenuItem`, `JCheckBoxMenuItem` and `JRadioButtonMenuItem`
|
||||
non-opaque.
|
||||
- TextField, FormattedTextField and PasswordField: Select all text when a text
|
||||
field gains focus for the first time and selection was not set explicitly.
|
||||
This can be configured to newer or always select all text on focus gain (see
|
||||
|
||||
@@ -16,7 +16,12 @@
|
||||
|
||||
package com.formdev.flatlaf.ui;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Container;
|
||||
import java.awt.Insets;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.UIManager;
|
||||
import com.formdev.flatlaf.util.UIScale;
|
||||
|
||||
/**
|
||||
* Border for {@link javax.swing.JPopupMenu}.
|
||||
@@ -33,4 +38,18 @@ public class FlatPopupMenuBorder
|
||||
super( UIManager.getInsets( "PopupMenu.borderInsets" ),
|
||||
UIManager.getColor( "PopupMenu.borderColor" ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Insets getBorderInsets( Component c, Insets insets ) {
|
||||
if( c instanceof Container &&
|
||||
((Container)c).getComponentCount() > 0 &&
|
||||
((Container)c).getComponent( 0 ) instanceof JScrollPane )
|
||||
{
|
||||
// e.g. for combobox popups
|
||||
insets.left = insets.top = insets.right = insets.bottom = UIScale.scale( 1 );
|
||||
return insets;
|
||||
}
|
||||
|
||||
return super.getBorderInsets( c, insets );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
@selectionInactiveForeground=@foreground
|
||||
@disabledText=#777777
|
||||
@textComponentBackground=#45494A
|
||||
@menuBackground=darken(@background,5%)
|
||||
@cellFocusColor=#000000
|
||||
@icon=#adadad
|
||||
|
||||
|
||||
@@ -121,6 +121,8 @@ CheckBoxMenuItem.border=com.formdev.flatlaf.ui.FlatMarginBorder
|
||||
CheckBoxMenuItem.checkIcon=com.formdev.flatlaf.icons.FlatCheckBoxMenuItemIcon
|
||||
CheckBoxMenuItem.arrowIcon=com.formdev.flatlaf.icons.FlatMenuItemArrowIcon
|
||||
CheckBoxMenuItem.margin=2,2,2,2
|
||||
CheckBoxMenuItem.opaque=false
|
||||
CheckBoxMenuItem.background=@menuBackground
|
||||
|
||||
|
||||
#---- ColorChooser ----
|
||||
@@ -216,12 +218,15 @@ Menu.border=com.formdev.flatlaf.ui.FlatMarginBorder
|
||||
Menu.arrowIcon=com.formdev.flatlaf.icons.FlatMenuArrowIcon
|
||||
Menu.margin=2,2,2,2
|
||||
Menu.submenuPopupOffsetX={scaledInteger}-4
|
||||
Menu.submenuPopupOffsetY={scaledInteger}-1
|
||||
Menu.submenuPopupOffsetY={scaledInteger}-4
|
||||
Menu.opaque=false
|
||||
Menu.background=@menuBackground
|
||||
|
||||
|
||||
#---- MenuBar ----
|
||||
|
||||
MenuBar.border=com.formdev.flatlaf.ui.FlatMenuBarBorder
|
||||
MenuBar.background=@menuBackground
|
||||
|
||||
|
||||
#---- MenuItem ----
|
||||
@@ -229,6 +234,8 @@ MenuBar.border=com.formdev.flatlaf.ui.FlatMenuBarBorder
|
||||
MenuItem.border=com.formdev.flatlaf.ui.FlatMarginBorder
|
||||
MenuItem.arrowIcon=com.formdev.flatlaf.icons.FlatMenuItemArrowIcon
|
||||
MenuItem.margin=2,2,2,2
|
||||
MenuItem.opaque=false
|
||||
MenuItem.background=@menuBackground
|
||||
|
||||
|
||||
#---- OptionPane ----
|
||||
@@ -265,7 +272,8 @@ PasswordField.placeholderForeground=@disabledText
|
||||
#---- PopupMenu ----
|
||||
|
||||
PopupMenu.border=com.formdev.flatlaf.ui.FlatPopupMenuBorder
|
||||
PopupMenu.borderInsets=1,1,1,1
|
||||
PopupMenu.borderInsets=4,1,4,1
|
||||
PopupMenu.background=@menuBackground
|
||||
|
||||
|
||||
#---- PopupMenuSeparator ----
|
||||
@@ -299,6 +307,8 @@ RadioButtonMenuItem.border=com.formdev.flatlaf.ui.FlatMarginBorder
|
||||
RadioButtonMenuItem.checkIcon=com.formdev.flatlaf.icons.FlatRadioButtonMenuItemIcon
|
||||
RadioButtonMenuItem.arrowIcon=com.formdev.flatlaf.icons.FlatMenuItemArrowIcon
|
||||
RadioButtonMenuItem.margin=2,2,2,2
|
||||
RadioButtonMenuItem.opaque=false
|
||||
RadioButtonMenuItem.background=@menuBackground
|
||||
|
||||
|
||||
#---- ScrollBar ----
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
@selectionInactiveForeground=@foreground
|
||||
@disabledText=#8C8C8C
|
||||
@textComponentBackground=#ffffff
|
||||
@menuBackground=#fff
|
||||
@cellFocusColor=#000000
|
||||
@icon=#afafaf
|
||||
|
||||
|
||||
Reference in New Issue
Block a user