mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-08 15:00:54 +03:00
CheckBoxMenuItem and RadioButtonMenuItem: improved checkmark background colors of selected menu items that have also an icon
This commit is contained in:
@@ -11,6 +11,9 @@ FlatLaf Change Log
|
|||||||
painted over active tab underline.
|
painted over active tab underline.
|
||||||
- TabbedPane: Support hiding separator between tabs and content area (set client
|
- TabbedPane: Support hiding separator between tabs and content area (set client
|
||||||
property `JTabbedPane.showContentSeparator` to `false`).
|
property `JTabbedPane.showContentSeparator` to `false`).
|
||||||
|
- CheckBoxMenuItem and RadioButtonMenuItem: Improved checkmark background colors
|
||||||
|
of selected menu items that have also an icon. This makes it is easier to
|
||||||
|
recognize selected menu items.
|
||||||
|
|
||||||
#### Fixed bugs
|
#### Fixed bugs
|
||||||
|
|
||||||
|
|||||||
@@ -30,8 +30,7 @@
|
|||||||
@textComponentBackground=#45494A
|
@textComponentBackground=#45494A
|
||||||
@menuBackground=darken(@background,5%)
|
@menuBackground=darken(@background,5%)
|
||||||
@menuHoverBackground=lighten(@menuBackground,10%,derived)
|
@menuHoverBackground=lighten(@menuBackground,10%,derived)
|
||||||
@menuCheckBackground=lighten(@menuBackground,10%,derived)
|
@menuCheckBackground=darken(@selectionBackground,10%)
|
||||||
@menuCheckHoverBackground=lighten(@menuBackground,20%,derived)
|
|
||||||
@menuAcceleratorForeground=darken(@foreground,15%)
|
@menuAcceleratorForeground=darken(@foreground,15%)
|
||||||
@menuAcceleratorSelectionForeground=@selectionForeground
|
@menuAcceleratorSelectionForeground=@selectionForeground
|
||||||
@cellFocusColor=#000
|
@cellFocusColor=#000
|
||||||
|
|||||||
@@ -359,7 +359,7 @@ MenuItem.acceleratorDelimiter=-
|
|||||||
|
|
||||||
# for MenuItem.selectionType=underline
|
# for MenuItem.selectionType=underline
|
||||||
MenuItem.underlineSelectionBackground=@menuHoverBackground
|
MenuItem.underlineSelectionBackground=@menuHoverBackground
|
||||||
MenuItem.underlineSelectionCheckBackground=@menuCheckHoverBackground
|
MenuItem.underlineSelectionCheckBackground=@menuCheckBackground
|
||||||
MenuItem.underlineSelectionColor=$TabbedPane.underlineColor
|
MenuItem.underlineSelectionColor=$TabbedPane.underlineColor
|
||||||
MenuItem.underlineSelectionHeight=3
|
MenuItem.underlineSelectionHeight=3
|
||||||
|
|
||||||
|
|||||||
@@ -30,8 +30,7 @@
|
|||||||
@textComponentBackground=#fff
|
@textComponentBackground=#fff
|
||||||
@menuBackground=#fff
|
@menuBackground=#fff
|
||||||
@menuHoverBackground=darken(@menuBackground,10%,derived)
|
@menuHoverBackground=darken(@menuBackground,10%,derived)
|
||||||
@menuCheckBackground=darken(@menuBackground,10%,derived)
|
@menuCheckBackground=lighten(@selectionBackground,40%)
|
||||||
@menuCheckHoverBackground=darken(@menuBackground,20%,derived)
|
|
||||||
@menuAcceleratorForeground=lighten(@foreground,30%)
|
@menuAcceleratorForeground=lighten(@foreground,30%)
|
||||||
@menuAcceleratorSelectionForeground=@selectionForeground
|
@menuAcceleratorSelectionForeground=@selectionForeground
|
||||||
@cellFocusColor=#000
|
@cellFocusColor=#000
|
||||||
|
|||||||
@@ -542,7 +542,7 @@ MenuItem.arrowIcon [lazy] 6,10 com.formdev.flatlaf.icons.FlatMenu
|
|||||||
MenuItem.background #303234 javax.swing.plaf.ColorUIResource [UI]
|
MenuItem.background #303234 javax.swing.plaf.ColorUIResource [UI]
|
||||||
MenuItem.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatMenuItemBorder [UI]
|
MenuItem.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatMenuItemBorder [UI]
|
||||||
MenuItem.borderPainted true
|
MenuItem.borderPainted true
|
||||||
MenuItem.checkBackground #484c4f com.formdev.flatlaf.util.DerivedColor [UI] lighten(10% autoInverse)
|
MenuItem.checkBackground #3c588b javax.swing.plaf.ColorUIResource [UI]
|
||||||
MenuItem.checkMargins 2,2,2,2 javax.swing.plaf.InsetsUIResource [UI]
|
MenuItem.checkMargins 2,2,2,2 javax.swing.plaf.InsetsUIResource [UI]
|
||||||
MenuItem.disabledForeground #888888 javax.swing.plaf.ColorUIResource [UI]
|
MenuItem.disabledForeground #888888 javax.swing.plaf.ColorUIResource [UI]
|
||||||
MenuItem.font [active] $defaultFont [UI]
|
MenuItem.font [active] $defaultFont [UI]
|
||||||
@@ -557,7 +557,7 @@ MenuItem.selectionForeground #bbbbbb javax.swing.plaf.ColorUIResource [UI]
|
|||||||
MenuItem.textAcceleratorGap 24
|
MenuItem.textAcceleratorGap 24
|
||||||
MenuItem.textNoAcceleratorGap 6
|
MenuItem.textNoAcceleratorGap 6
|
||||||
MenuItem.underlineSelectionBackground #484c4f com.formdev.flatlaf.util.DerivedColor [UI] lighten(10% autoInverse)
|
MenuItem.underlineSelectionBackground #484c4f com.formdev.flatlaf.util.DerivedColor [UI] lighten(10% autoInverse)
|
||||||
MenuItem.underlineSelectionCheckBackground #616569 com.formdev.flatlaf.util.DerivedColor [UI] lighten(20% autoInverse)
|
MenuItem.underlineSelectionCheckBackground #3c588b javax.swing.plaf.ColorUIResource [UI]
|
||||||
MenuItem.underlineSelectionColor #4a88c7 javax.swing.plaf.ColorUIResource [UI]
|
MenuItem.underlineSelectionColor #4a88c7 javax.swing.plaf.ColorUIResource [UI]
|
||||||
MenuItem.underlineSelectionHeight 3
|
MenuItem.underlineSelectionHeight 3
|
||||||
|
|
||||||
|
|||||||
@@ -547,7 +547,7 @@ MenuItem.arrowIcon [lazy] 6,10 com.formdev.flatlaf.icons.FlatMenu
|
|||||||
MenuItem.background #ffffff javax.swing.plaf.ColorUIResource [UI]
|
MenuItem.background #ffffff javax.swing.plaf.ColorUIResource [UI]
|
||||||
MenuItem.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatMenuItemBorder [UI]
|
MenuItem.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatMenuItemBorder [UI]
|
||||||
MenuItem.borderPainted true
|
MenuItem.borderPainted true
|
||||||
MenuItem.checkBackground #e6e6e6 com.formdev.flatlaf.util.DerivedColor [UI] darken(10% autoInverse)
|
MenuItem.checkBackground #bfd9f2 javax.swing.plaf.ColorUIResource [UI]
|
||||||
MenuItem.checkMargins 2,2,2,2 javax.swing.plaf.InsetsUIResource [UI]
|
MenuItem.checkMargins 2,2,2,2 javax.swing.plaf.InsetsUIResource [UI]
|
||||||
MenuItem.disabledForeground #8c8c8c javax.swing.plaf.ColorUIResource [UI]
|
MenuItem.disabledForeground #8c8c8c javax.swing.plaf.ColorUIResource [UI]
|
||||||
MenuItem.font [active] $defaultFont [UI]
|
MenuItem.font [active] $defaultFont [UI]
|
||||||
@@ -562,7 +562,7 @@ MenuItem.selectionForeground #ffffff javax.swing.plaf.ColorUIResource [UI]
|
|||||||
MenuItem.textAcceleratorGap 24
|
MenuItem.textAcceleratorGap 24
|
||||||
MenuItem.textNoAcceleratorGap 6
|
MenuItem.textNoAcceleratorGap 6
|
||||||
MenuItem.underlineSelectionBackground #e6e6e6 com.formdev.flatlaf.util.DerivedColor [UI] darken(10% autoInverse)
|
MenuItem.underlineSelectionBackground #e6e6e6 com.formdev.flatlaf.util.DerivedColor [UI] darken(10% autoInverse)
|
||||||
MenuItem.underlineSelectionCheckBackground #cccccc com.formdev.flatlaf.util.DerivedColor [UI] darken(20% autoInverse)
|
MenuItem.underlineSelectionCheckBackground #bfd9f2 javax.swing.plaf.ColorUIResource [UI]
|
||||||
MenuItem.underlineSelectionColor #4083c9 javax.swing.plaf.ColorUIResource [UI]
|
MenuItem.underlineSelectionColor #4083c9 javax.swing.plaf.ColorUIResource [UI]
|
||||||
MenuItem.underlineSelectionHeight 3
|
MenuItem.underlineSelectionHeight 3
|
||||||
|
|
||||||
|
|||||||
@@ -535,7 +535,7 @@ MenuItem.arrowIcon [lazy] 6,10 com.formdev.flatlaf.icons.FlatMenu
|
|||||||
MenuItem.background #ffffff javax.swing.plaf.ColorUIResource [UI]
|
MenuItem.background #ffffff javax.swing.plaf.ColorUIResource [UI]
|
||||||
MenuItem.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatMenuItemBorder [UI]
|
MenuItem.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatMenuItemBorder [UI]
|
||||||
MenuItem.borderPainted true
|
MenuItem.borderPainted true
|
||||||
MenuItem.checkBackground #e6e6e6 javax.swing.plaf.ColorUIResource [UI]
|
MenuItem.checkBackground #ccccff javax.swing.plaf.ColorUIResource [UI]
|
||||||
MenuItem.checkMargins 2,2,2,2 javax.swing.plaf.InsetsUIResource [UI]
|
MenuItem.checkMargins 2,2,2,2 javax.swing.plaf.InsetsUIResource [UI]
|
||||||
MenuItem.disabledForeground #000088 javax.swing.plaf.ColorUIResource [UI]
|
MenuItem.disabledForeground #000088 javax.swing.plaf.ColorUIResource [UI]
|
||||||
MenuItem.font [active] $defaultFont [UI]
|
MenuItem.font [active] $defaultFont [UI]
|
||||||
@@ -550,7 +550,7 @@ MenuItem.selectionForeground #ffff00 javax.swing.plaf.ColorUIResource [UI]
|
|||||||
MenuItem.textAcceleratorGap 24
|
MenuItem.textAcceleratorGap 24
|
||||||
MenuItem.textNoAcceleratorGap 6
|
MenuItem.textNoAcceleratorGap 6
|
||||||
MenuItem.underlineSelectionBackground #e6e6e6 javax.swing.plaf.ColorUIResource [UI]
|
MenuItem.underlineSelectionBackground #e6e6e6 javax.swing.plaf.ColorUIResource [UI]
|
||||||
MenuItem.underlineSelectionCheckBackground #cccccc javax.swing.plaf.ColorUIResource [UI]
|
MenuItem.underlineSelectionCheckBackground #ccccff javax.swing.plaf.ColorUIResource [UI]
|
||||||
MenuItem.underlineSelectionColor #4a88c7 javax.swing.plaf.ColorUIResource [UI]
|
MenuItem.underlineSelectionColor #4a88c7 javax.swing.plaf.ColorUIResource [UI]
|
||||||
MenuItem.underlineSelectionHeight 3
|
MenuItem.underlineSelectionHeight 3
|
||||||
|
|
||||||
|
|||||||
@@ -21,11 +21,13 @@ import java.awt.Component;
|
|||||||
import java.awt.Container;
|
import java.awt.Container;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
import java.awt.event.*;
|
import java.awt.event.*;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.plaf.ColorUIResource;
|
import javax.swing.plaf.ColorUIResource;
|
||||||
import com.formdev.flatlaf.FlatLaf;
|
import com.formdev.flatlaf.FlatLaf;
|
||||||
|
import com.formdev.flatlaf.icons.FlatAbstractIcon;
|
||||||
import com.formdev.flatlaf.util.UIScale;
|
import com.formdev.flatlaf.util.UIScale;
|
||||||
import net.miginfocom.swing.*;
|
import net.miginfocom.swing.*;
|
||||||
|
|
||||||
@@ -147,10 +149,12 @@ public class FlatMenusTest
|
|||||||
JMenuItem menuItem37 = new JMenuItem();
|
JMenuItem menuItem37 = new JMenuItem();
|
||||||
JCheckBoxMenuItem checkBoxMenuItem6 = new JCheckBoxMenuItem();
|
JCheckBoxMenuItem checkBoxMenuItem6 = new JCheckBoxMenuItem();
|
||||||
JCheckBoxMenuItem checkBoxMenuItem7 = new JCheckBoxMenuItem();
|
JCheckBoxMenuItem checkBoxMenuItem7 = new JCheckBoxMenuItem();
|
||||||
|
JCheckBoxMenuItem checkBoxMenuItem8 = new JCheckBoxMenuItem();
|
||||||
JRadioButtonMenuItem radioButtonMenuItem5 = new JRadioButtonMenuItem();
|
JRadioButtonMenuItem radioButtonMenuItem5 = new JRadioButtonMenuItem();
|
||||||
JRadioButtonMenuItem radioButtonMenuItem6 = new JRadioButtonMenuItem();
|
JRadioButtonMenuItem radioButtonMenuItem6 = new JRadioButtonMenuItem();
|
||||||
JRadioButtonMenuItem radioButtonMenuItem8 = new JRadioButtonMenuItem();
|
JRadioButtonMenuItem radioButtonMenuItem8 = new JRadioButtonMenuItem();
|
||||||
JRadioButtonMenuItem radioButtonMenuItem9 = new JRadioButtonMenuItem();
|
JRadioButtonMenuItem radioButtonMenuItem9 = new JRadioButtonMenuItem();
|
||||||
|
JRadioButtonMenuItem radioButtonMenuItem10 = new JRadioButtonMenuItem();
|
||||||
JMenu menu6 = new JMenu();
|
JMenu menu6 = new JMenu();
|
||||||
JMenuItem menuItem5 = new JMenuItem();
|
JMenuItem menuItem5 = new JMenuItem();
|
||||||
JMenuItem menuItem6 = new JMenuItem();
|
JMenuItem menuItem6 = new JMenuItem();
|
||||||
@@ -299,6 +303,11 @@ public class FlatMenusTest
|
|||||||
checkBoxMenuItem7.setSelected(true);
|
checkBoxMenuItem7.setSelected(true);
|
||||||
checkBoxMenuItem7.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showReadAccess.png")));
|
checkBoxMenuItem7.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showReadAccess.png")));
|
||||||
menu5.add(checkBoxMenuItem7);
|
menu5.add(checkBoxMenuItem7);
|
||||||
|
|
||||||
|
//---- checkBoxMenuItem8 ----
|
||||||
|
checkBoxMenuItem8.setText("check with larger icon");
|
||||||
|
checkBoxMenuItem8.setSelected(true);
|
||||||
|
menu5.add(checkBoxMenuItem8);
|
||||||
menu5.addSeparator();
|
menu5.addSeparator();
|
||||||
|
|
||||||
//---- radioButtonMenuItem5 ----
|
//---- radioButtonMenuItem5 ----
|
||||||
@@ -321,6 +330,10 @@ public class FlatMenusTest
|
|||||||
radioButtonMenuItem9.setText("radio with icon 2");
|
radioButtonMenuItem9.setText("radio with icon 2");
|
||||||
radioButtonMenuItem9.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showWriteAccess.png")));
|
radioButtonMenuItem9.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showWriteAccess.png")));
|
||||||
menu5.add(radioButtonMenuItem9);
|
menu5.add(radioButtonMenuItem9);
|
||||||
|
|
||||||
|
//---- radioButtonMenuItem10 ----
|
||||||
|
radioButtonMenuItem10.setText("radio with larger icon");
|
||||||
|
menu5.add(radioButtonMenuItem10);
|
||||||
}
|
}
|
||||||
menuBar1.add(menu5);
|
menuBar1.add(menu5);
|
||||||
|
|
||||||
@@ -763,7 +776,17 @@ public class FlatMenusTest
|
|||||||
ButtonGroup buttonGroup2 = new ButtonGroup();
|
ButtonGroup buttonGroup2 = new ButtonGroup();
|
||||||
buttonGroup2.add(radioButtonMenuItem8);
|
buttonGroup2.add(radioButtonMenuItem8);
|
||||||
buttonGroup2.add(radioButtonMenuItem9);
|
buttonGroup2.add(radioButtonMenuItem9);
|
||||||
|
buttonGroup2.add(radioButtonMenuItem10);
|
||||||
// JFormDesigner - End of component initialization //GEN-END:initComponents
|
// JFormDesigner - End of component initialization //GEN-END:initComponents
|
||||||
|
|
||||||
|
Icon largerIcon = new FlatAbstractIcon( 16, 16, Color.orange ) {
|
||||||
|
@Override
|
||||||
|
protected void paintIcon( Component c, Graphics2D g2 ) {
|
||||||
|
g2.fillRect( 0, 0, 16, 16 );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
checkBoxMenuItem8.setIcon( largerIcon );
|
||||||
|
radioButtonMenuItem10.setIcon( largerIcon );
|
||||||
}
|
}
|
||||||
|
|
||||||
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
|
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
JFDML JFormDesigner: "7.0.2.0.298" Java: "14" encoding: "UTF-8"
|
JFDML JFormDesigner: "7.0.2.0.298" Java: "15" encoding: "UTF-8"
|
||||||
|
|
||||||
new FormModel {
|
new FormModel {
|
||||||
contentType: "form/swing"
|
contentType: "form/swing"
|
||||||
@@ -77,6 +77,11 @@ new FormModel {
|
|||||||
"selected": true
|
"selected": true
|
||||||
"icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showReadAccess.png" )
|
"icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showReadAccess.png" )
|
||||||
} )
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JCheckBoxMenuItem" ) {
|
||||||
|
name: "checkBoxMenuItem8"
|
||||||
|
"text": "check with larger icon"
|
||||||
|
"selected": true
|
||||||
|
} )
|
||||||
add( new FormComponent( "javax.swing.JPopupMenu$Separator" ) {
|
add( new FormComponent( "javax.swing.JPopupMenu$Separator" ) {
|
||||||
name: "separator5"
|
name: "separator5"
|
||||||
} )
|
} )
|
||||||
@@ -104,9 +109,14 @@ new FormModel {
|
|||||||
add( new FormComponent( "javax.swing.JRadioButtonMenuItem" ) {
|
add( new FormComponent( "javax.swing.JRadioButtonMenuItem" ) {
|
||||||
name: "radioButtonMenuItem9"
|
name: "radioButtonMenuItem9"
|
||||||
"text": "radio with icon 2"
|
"text": "radio with icon 2"
|
||||||
"$buttonGroup": new FormReference( "buttonGroup2" )
|
"$buttonGroup": &FormReference0 new FormReference( "buttonGroup2" )
|
||||||
"icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showWriteAccess.png" )
|
"icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showWriteAccess.png" )
|
||||||
} )
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JRadioButtonMenuItem" ) {
|
||||||
|
name: "radioButtonMenuItem10"
|
||||||
|
"text": "radio with larger icon"
|
||||||
|
"$buttonGroup": #FormReference0
|
||||||
|
} )
|
||||||
} )
|
} )
|
||||||
add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) {
|
add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) {
|
||||||
name: "menu6"
|
name: "menu6"
|
||||||
|
|||||||
@@ -26,8 +26,7 @@
|
|||||||
@textComponentBackground=#fff
|
@textComponentBackground=#fff
|
||||||
@menuBackground=#fff
|
@menuBackground=#fff
|
||||||
@menuHoverBackground=darken(@menuBackground,10%)
|
@menuHoverBackground=darken(@menuBackground,10%)
|
||||||
@menuCheckBackground=darken(@menuBackground,10%)
|
@menuCheckBackground=#ccf
|
||||||
@menuCheckHoverBackground=darken(@menuBackground,20%)
|
|
||||||
@menuAcceleratorForeground=#f88
|
@menuAcceleratorForeground=#f88
|
||||||
@menuAcceleratorSelectionForeground=#fff
|
@menuAcceleratorSelectionForeground=#fff
|
||||||
@cellFocusColor=#f00
|
@cellFocusColor=#f00
|
||||||
|
|||||||
Reference in New Issue
Block a user