Starryi
3 years ago
9 changed files with 126 additions and 13 deletions
@ -0,0 +1,44 @@
|
||||
package com.fr.design.mainframe.share.ui.actions; |
||||
|
||||
import com.fr.design.constants.UIConstants; |
||||
import com.fr.design.gui.imenu.UIMenuItemUI; |
||||
import com.fr.design.utils.gui.GUIPaintUtils; |
||||
import com.fr.stable.Constants; |
||||
|
||||
import javax.swing.ButtonModel; |
||||
import javax.swing.JMenu; |
||||
import javax.swing.JMenuItem; |
||||
import javax.swing.JPopupMenu; |
||||
import java.awt.Color; |
||||
import java.awt.Graphics; |
||||
import java.awt.Graphics2D; |
||||
|
||||
/** |
||||
* @author Starryi |
||||
* @version 1.0 |
||||
* Created by Starryi on 2021/10/18 |
||||
*/ |
||||
public class SharedComponentActionMenuItemUI extends UIMenuItemUI { |
||||
|
||||
@Override |
||||
protected void paintBackground(Graphics g, JMenuItem menuItem, Color bgColor) { |
||||
ButtonModel model = menuItem.getModel(); |
||||
Color oldColor = g.getColor(); |
||||
int menuWidth = menuItem.getWidth(); |
||||
int menuHeight = menuItem.getHeight(); |
||||
|
||||
g.setColor(UIConstants.NORMAL_BACKGROUND); |
||||
g.fillRect(0, 0, menuWidth, menuHeight); |
||||
if (menuItem.isOpaque()) { |
||||
if (model.isArmed() || (menuItem instanceof JMenu && model.isSelected())) { |
||||
GUIPaintUtils.fillPaint((Graphics2D) g, 0, 0, menuWidth, menuHeight, true, Constants.NULL, UIConstants.FLESH_BLUE, 7); |
||||
} else { |
||||
GUIPaintUtils.fillPaint((Graphics2D) g, 0, 0, menuWidth, menuHeight, true, Constants.NULL, menuItem.getBackground(), 7); |
||||
} |
||||
g.setColor(oldColor); |
||||
} else if (model.isArmed() || (menuItem instanceof JMenu && model.isSelected())) { |
||||
GUIPaintUtils.fillPaint((Graphics2D) g, 0, 0, menuWidth, menuHeight, true, Constants.NULL, UIConstants.FLESH_BLUE, 7); |
||||
g.setColor(oldColor); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,12 @@
|
||||
package com.fr.design.mainframe.share.ui.constants; |
||||
|
||||
import java.awt.Color; |
||||
|
||||
/** |
||||
* @author Starryi |
||||
* @version 1.0 |
||||
* Created by Starryi on 2021/10/19 |
||||
*/ |
||||
public class ColorConstants { |
||||
public static final Color BACKGROUND = new Color(0xF0F0F1); |
||||
} |
Loading…
Reference in new issue