mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-06 14:00:55 +03:00
Menus: support switching "underline" menu selection type at any time without updating UI (issue #49)
This commit is contained in:
@@ -55,7 +55,6 @@ public class FlatMenuItemRenderer
|
|||||||
protected final int textAcceleratorGap;
|
protected final int textAcceleratorGap;
|
||||||
protected final int textArrowGap;
|
protected final int textArrowGap;
|
||||||
|
|
||||||
protected final String selectionType = UIManager.getString( "MenuItem.selectionType" );
|
|
||||||
protected final Color underlineSelectionBackground = UIManager.getColor( "MenuItem.underlineSelectionBackground" );
|
protected final Color underlineSelectionBackground = UIManager.getColor( "MenuItem.underlineSelectionBackground" );
|
||||||
protected final Color underlineSelectionColor = UIManager.getColor( "MenuItem.underlineSelectionColor" );
|
protected final Color underlineSelectionColor = UIManager.getColor( "MenuItem.underlineSelectionColor" );
|
||||||
protected final int underlineSelectionHeight = UIManager.getInt( "MenuItem.underlineSelectionHeight" );
|
protected final int underlineSelectionHeight = UIManager.getInt( "MenuItem.underlineSelectionHeight" );
|
||||||
@@ -340,7 +339,7 @@ debug*/
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean isUnderlineSelection() {
|
private boolean isUnderlineSelection() {
|
||||||
return "underline".equals( selectionType );
|
return "underline".equals( UIManager.getString( "MenuItem.selectionType" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
private Icon getIconForPainting() {
|
private Icon getIconForPainting() {
|
||||||
|
|||||||
@@ -61,7 +61,6 @@ class DemoFrame
|
|||||||
|
|
||||||
private void underlineMenuSelection() {
|
private void underlineMenuSelection() {
|
||||||
UIManager.put( "MenuItem.selectionType", underlineMenuSelectionMenuItem.isSelected() ? "underline" : null );
|
UIManager.put( "MenuItem.selectionType", underlineMenuSelectionMenuItem.isSelected() ? "underline" : null );
|
||||||
FlatLaf.updateUI();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fontFamilyChanged( ActionEvent e ) {
|
private void fontFamilyChanged( ActionEvent e ) {
|
||||||
|
|||||||
@@ -64,7 +64,9 @@ public class FlatMenusTest
|
|||||||
|
|
||||||
private void underlineChanged() {
|
private void underlineChanged() {
|
||||||
UIManager.put( "MenuItem.selectionType", underlineCheckBox.isSelected() ? "underline" : null );
|
UIManager.put( "MenuItem.selectionType", underlineCheckBox.isSelected() ? "underline" : null );
|
||||||
FlatLaf.updateUI();
|
|
||||||
|
if( armedCheckBox.isSelected() )
|
||||||
|
FlatLaf.updateUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showPopupMenuButtonActionPerformed(ActionEvent e) {
|
private void showPopupMenuButtonActionPerformed(ActionEvent e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user