mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-07 22:40:53 +03:00
CheckBoxMenuItem and RadioButtonMenuItem: improved checkmark background colors of selected menu items that have also an icon
This commit is contained in:
@@ -542,7 +542,7 @@ MenuItem.arrowIcon [lazy] 6,10 com.formdev.flatlaf.icons.FlatMenu
|
||||
MenuItem.background #303234 javax.swing.plaf.ColorUIResource [UI]
|
||||
MenuItem.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatMenuItemBorder [UI]
|
||||
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.disabledForeground #888888 javax.swing.plaf.ColorUIResource [UI]
|
||||
MenuItem.font [active] $defaultFont [UI]
|
||||
@@ -557,7 +557,7 @@ MenuItem.selectionForeground #bbbbbb javax.swing.plaf.ColorUIResource [UI]
|
||||
MenuItem.textAcceleratorGap 24
|
||||
MenuItem.textNoAcceleratorGap 6
|
||||
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.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.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatMenuItemBorder [UI]
|
||||
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.disabledForeground #8c8c8c javax.swing.plaf.ColorUIResource [UI]
|
||||
MenuItem.font [active] $defaultFont [UI]
|
||||
@@ -562,7 +562,7 @@ MenuItem.selectionForeground #ffffff javax.swing.plaf.ColorUIResource [UI]
|
||||
MenuItem.textAcceleratorGap 24
|
||||
MenuItem.textNoAcceleratorGap 6
|
||||
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.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.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatMenuItemBorder [UI]
|
||||
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.disabledForeground #000088 javax.swing.plaf.ColorUIResource [UI]
|
||||
MenuItem.font [active] $defaultFont [UI]
|
||||
@@ -550,7 +550,7 @@ MenuItem.selectionForeground #ffff00 javax.swing.plaf.ColorUIResource [UI]
|
||||
MenuItem.textAcceleratorGap 24
|
||||
MenuItem.textNoAcceleratorGap 6
|
||||
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.underlineSelectionHeight 3
|
||||
|
||||
|
||||
@@ -21,11 +21,13 @@ import java.awt.Component;
|
||||
import java.awt.Container;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.event.*;
|
||||
import java.util.function.Supplier;
|
||||
import javax.swing.*;
|
||||
import javax.swing.plaf.ColorUIResource;
|
||||
import com.formdev.flatlaf.FlatLaf;
|
||||
import com.formdev.flatlaf.icons.FlatAbstractIcon;
|
||||
import com.formdev.flatlaf.util.UIScale;
|
||||
import net.miginfocom.swing.*;
|
||||
|
||||
@@ -147,10 +149,12 @@ public class FlatMenusTest
|
||||
JMenuItem menuItem37 = new JMenuItem();
|
||||
JCheckBoxMenuItem checkBoxMenuItem6 = new JCheckBoxMenuItem();
|
||||
JCheckBoxMenuItem checkBoxMenuItem7 = new JCheckBoxMenuItem();
|
||||
JCheckBoxMenuItem checkBoxMenuItem8 = new JCheckBoxMenuItem();
|
||||
JRadioButtonMenuItem radioButtonMenuItem5 = new JRadioButtonMenuItem();
|
||||
JRadioButtonMenuItem radioButtonMenuItem6 = new JRadioButtonMenuItem();
|
||||
JRadioButtonMenuItem radioButtonMenuItem8 = new JRadioButtonMenuItem();
|
||||
JRadioButtonMenuItem radioButtonMenuItem9 = new JRadioButtonMenuItem();
|
||||
JRadioButtonMenuItem radioButtonMenuItem10 = new JRadioButtonMenuItem();
|
||||
JMenu menu6 = new JMenu();
|
||||
JMenuItem menuItem5 = new JMenuItem();
|
||||
JMenuItem menuItem6 = new JMenuItem();
|
||||
@@ -299,6 +303,11 @@ public class FlatMenusTest
|
||||
checkBoxMenuItem7.setSelected(true);
|
||||
checkBoxMenuItem7.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showReadAccess.png")));
|
||||
menu5.add(checkBoxMenuItem7);
|
||||
|
||||
//---- checkBoxMenuItem8 ----
|
||||
checkBoxMenuItem8.setText("check with larger icon");
|
||||
checkBoxMenuItem8.setSelected(true);
|
||||
menu5.add(checkBoxMenuItem8);
|
||||
menu5.addSeparator();
|
||||
|
||||
//---- radioButtonMenuItem5 ----
|
||||
@@ -321,6 +330,10 @@ public class FlatMenusTest
|
||||
radioButtonMenuItem9.setText("radio with icon 2");
|
||||
radioButtonMenuItem9.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showWriteAccess.png")));
|
||||
menu5.add(radioButtonMenuItem9);
|
||||
|
||||
//---- radioButtonMenuItem10 ----
|
||||
radioButtonMenuItem10.setText("radio with larger icon");
|
||||
menu5.add(radioButtonMenuItem10);
|
||||
}
|
||||
menuBar1.add(menu5);
|
||||
|
||||
@@ -763,7 +776,17 @@ public class FlatMenusTest
|
||||
ButtonGroup buttonGroup2 = new ButtonGroup();
|
||||
buttonGroup2.add(radioButtonMenuItem8);
|
||||
buttonGroup2.add(radioButtonMenuItem9);
|
||||
buttonGroup2.add(radioButtonMenuItem10);
|
||||
// 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
|
||||
|
||||
@@ -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 {
|
||||
contentType: "form/swing"
|
||||
@@ -77,6 +77,11 @@ new FormModel {
|
||||
"selected": true
|
||||
"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" ) {
|
||||
name: "separator5"
|
||||
} )
|
||||
@@ -104,9 +109,14 @@ new FormModel {
|
||||
add( new FormComponent( "javax.swing.JRadioButtonMenuItem" ) {
|
||||
name: "radioButtonMenuItem9"
|
||||
"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" )
|
||||
} )
|
||||
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 ) ) {
|
||||
name: "menu6"
|
||||
|
||||
@@ -26,8 +26,7 @@
|
||||
@textComponentBackground=#fff
|
||||
@menuBackground=#fff
|
||||
@menuHoverBackground=darken(@menuBackground,10%)
|
||||
@menuCheckBackground=darken(@menuBackground,10%)
|
||||
@menuCheckHoverBackground=darken(@menuBackground,20%)
|
||||
@menuCheckBackground=#ccf
|
||||
@menuAcceleratorForeground=#f88
|
||||
@menuAcceleratorSelectionForeground=#fff
|
||||
@cellFocusColor=#f00
|
||||
|
||||
Reference in New Issue
Block a user