mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-06 22:10:54 +03:00
MenuBar.underlineSelectionColor
This commit is contained in:
@@ -246,7 +246,7 @@ public class FlatMenuItemRenderer
|
||||
g.setColor( Color.orange ); g.drawRect( arrowRect.x, arrowRect.y, arrowRect.width - 1, arrowRect.height - 1 );
|
||||
debug*/
|
||||
|
||||
paintBackground( g, selectionBackground );
|
||||
paintBackground( g, selectionBackground, underlineSelectionColor );
|
||||
paintIcon( g, iconRect, getIconForPainting() );
|
||||
paintText( g, textRect, menuItem.getText(), selectionForeground, disabledForeground );
|
||||
paintAccelerator( g, accelRect, getAcceleratorText(), acceleratorForeground, acceleratorSelectionForeground, disabledForeground );
|
||||
@@ -254,7 +254,7 @@ debug*/
|
||||
paintArrowIcon( g, arrowRect, arrowIcon );
|
||||
}
|
||||
|
||||
protected void paintBackground( Graphics g, Color selectionBackground ) {
|
||||
protected void paintBackground( Graphics g, Color selectionBackground, Color underlineSelectionColor ) {
|
||||
boolean armedOrSelected = isArmedOrSelected( menuItem );
|
||||
if( menuItem.isOpaque() || armedOrSelected ) {
|
||||
int width = menuItem.getWidth();
|
||||
|
||||
@@ -60,13 +60,16 @@ import javax.swing.plaf.basic.BasicMenuUI;
|
||||
* <!-- FlatMenuUI -->
|
||||
*
|
||||
* @uiDefault MenuItem.iconTextGap int
|
||||
* @uiDefault MenuBar.hoverBackground Color
|
||||
* @uiDefault MenuBar.hoverBackground
|
||||
* @uiDefault MenuBar.underlineSelectionColor Color
|
||||
*
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
public class FlatMenuUI
|
||||
extends BasicMenuUI
|
||||
{
|
||||
protected final Color menuBarUnderlineSelectionColor = UIManager.getColor( "MenuBar.underlineSelectionColor" );
|
||||
|
||||
private Color hoverBackground;
|
||||
private FlatMenuItemRenderer renderer;
|
||||
|
||||
@@ -154,7 +157,7 @@ public class FlatMenuUI
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintBackground( Graphics g, Color selectionBackground ) {
|
||||
protected void paintBackground( Graphics g, Color selectionBackground, Color menuItemUnderlineSelectionColor ) {
|
||||
ButtonModel model = menuItem.getModel();
|
||||
if( model.isRollover() && !model.isArmed() && !model.isSelected() &&
|
||||
model.isEnabled() && ((JMenu)menuItem).isTopLevelMenu() )
|
||||
@@ -162,7 +165,7 @@ public class FlatMenuUI
|
||||
g.setColor( deriveBackground( hoverBackground ) );
|
||||
g.fillRect( 0, 0, menuItem.getWidth(), menuItem.getHeight() );
|
||||
} else
|
||||
super.paintBackground( g, selectionBackground );
|
||||
super.paintBackground( g, selectionBackground, ((JMenu)menuItem).isTopLevelMenu() ? menuBarUnderlineSelectionColor : menuItemUnderlineSelectionColor );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -337,6 +337,7 @@ MenuBar.border=com.formdev.flatlaf.ui.FlatMenuBarBorder
|
||||
MenuBar.background=@menuBackground
|
||||
MenuBar.hoverBackground=@menuHoverBackground
|
||||
MenuBar.itemMargins=3,8,3,8
|
||||
MenuBar.underlineSelectionColor=$TabbedPane.underlineColor
|
||||
|
||||
|
||||
#---- MenuItem ----
|
||||
|
||||
Reference in New Issue
Block a user