Browse Source

REPORT-107973 翻新上下文菜单弹窗。透明按钮

newui
Leo.Qin 10 months ago
parent
commit
e48414f961
  1. 53
      designer-base/src/main/java/com/fine/theme/light/ui/FineButtonUI.java
  2. 9
      designer-base/src/main/java/com/fine/theme/light/ui/FineMenuItemUI.java
  3. 9
      designer-base/src/main/java/com/fine/theme/light/ui/FineMenuUI.java
  4. 6
      designer-base/src/main/java/com/fine/theme/light/ui/FinePopupMenuUI.java
  5. 6
      designer-base/src/main/java/com/fine/theme/utils/FineClientProperties.java
  6. 4
      designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java
  7. 4
      designer-base/src/main/java/com/fr/design/mainframe/JFormSliderPane.java
  8. 4
      designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java
  9. 10
      designer-base/src/main/java/com/fr/design/menu/MenuDef.java
  10. 4
      designer-base/src/main/java/com/fr/design/notification/ui/NotificationCenterPane.java
  11. 24
      designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties
  12. 9
      designer-base/src/test/java/com/fr/design/gui/storybook/components/PopupMenuStoryBoard.java
  13. 4
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java

53
designer-base/src/main/java/com/fine/theme/light/ui/FineButtonUI.java

@ -6,6 +6,7 @@ import com.formdev.flatlaf.ui.FlatButtonUI;
import com.formdev.flatlaf.ui.FlatUIUtils; import com.formdev.flatlaf.ui.FlatUIUtils;
import javax.swing.AbstractButton; import javax.swing.AbstractButton;
import javax.swing.ButtonModel;
import javax.swing.JButton; import javax.swing.JButton;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.plaf.ComponentUI; import javax.swing.plaf.ComponentUI;
@ -96,6 +97,58 @@ public class FineButtonUI extends FlatButtonUI {
} }
} }
@Override
protected Color getBackground(JComponent c) {
if (isTransparentButton(c)) {
return buttonStateColor(c,
disabledBackground,
hoverBackground,
pressedBackground);
} else {
return super.getBackground(c);
}
}
private boolean isTransparentButton(JComponent c) {
String buttonTypeStr = getButtonTypeStr((AbstractButton) c);
return FineClientProperties.BUTTON_TYPE_TRANSPARENT.equals(buttonTypeStr);
}
/**
* 获取按钮状态颜色
*
* @param c 组件
* @param disabledColor 禁用颜色
* @param hoverColor 鼠标悬停颜色
* @param pressedColor 鼠标按下颜色
* @return 按钮状态颜色
*/
public static Color buttonStateColor(Component c, Color disabledColor,
Color hoverColor, Color pressedColor) {
if (!c.isEnabled()) {
return disabledColor;
}
ButtonModel model = ((AbstractButton) c).getModel();
if (pressedColor != null && model.isPressed()) {
return pressedColor;
}
if (hoverColor != null && model.isRollover()) {
return hoverColor;
}
if (c.isOpaque()) {
return c.getBackground();
}
return null;
}
/** /**
* 创建UI * 创建UI
*/ */

9
designer-base/src/main/java/com/fine/theme/light/ui/FineMenuItemUI.java

@ -1,7 +1,6 @@
package com.fine.theme.light.ui; package com.fine.theme.light.ui;
import com.fine.theme.utils.FineClientProperties; import com.fine.theme.utils.FineClientProperties;
import com.fine.theme.utils.FineUIUtils;
import com.formdev.flatlaf.ui.FlatMenuItemUI; import com.formdev.flatlaf.ui.FlatMenuItemUI;
import com.fr.design.editlock.EditLockUtils; import com.fr.design.editlock.EditLockUtils;
@ -32,14 +31,6 @@ public class FineMenuItemUI extends FlatMenuItemUI {
@Override @Override
public void paint(Graphics g, JComponent c) { public void paint(Graphics g, JComponent c) {
Object clientProperty = c.getClientProperty(FineClientProperties.POPUP_MENU_TYPE);
if (FineClientProperties.POPUP_MENU_TYPE_TOOL_BAR.equals(clientProperty)) {
selectionBackground = FineUIUtils.getUIColor("Menu.toolbar.selectionBackground", "Menu.selectionBackground");
selectionForeground = FineUIUtils.getUIColor("Menu.toolbar.selectionForeground", "Menu.selectionForeground");
acceleratorForeground = FineUIUtils.getUIColor("Menu.toolbar.acceleratorForeground", "Menu.acceleratorForeground");
acceleratorSelectionForeground = FineUIUtils.getUIColor("Menu.toolbar.acceleratorSelectionForeground", "Menu.acceleratorSelectionForeground");
}
super.paint(g, c); super.paint(g, c);
Object itemType = c.getClientProperty(FineClientProperties.MENU_ITEM_TYPE); Object itemType = c.getClientProperty(FineClientProperties.MENU_ITEM_TYPE);

9
designer-base/src/main/java/com/fine/theme/light/ui/FineMenuUI.java

@ -1,8 +1,6 @@
package com.fine.theme.light.ui; package com.fine.theme.light.ui;
import com.fine.theme.icon.LazyIcon; import com.fine.theme.icon.LazyIcon;
import com.fine.theme.utils.FineClientProperties;
import com.fine.theme.utils.FineUIUtils;
import com.formdev.flatlaf.ui.FlatMenuUI; import com.formdev.flatlaf.ui.FlatMenuUI;
import javax.swing.JComponent; import javax.swing.JComponent;
@ -37,13 +35,6 @@ public class FineMenuUI extends FlatMenuUI {
@Override @Override
public void paint(Graphics g, JComponent c) { public void paint(Graphics g, JComponent c) {
Object clientProperty = c.getClientProperty(FineClientProperties.POPUP_MENU_TYPE);
if (FineClientProperties.POPUP_MENU_TYPE_TOOL_BAR.equals(clientProperty)) {
selectionBackground = FineUIUtils.getUIColor("MenuItem.toolbar.selectionBackground", "MenuItem.selectionBackground");
selectionForeground = FineUIUtils.getUIColor("MenuItem.toolbar.selectionForeground", "MenuItem.selectionForeground");
acceleratorForeground = FineUIUtils.getUIColor("MenuItem.toolbar.acceleratorForeground", "MenuItem.acceleratorForeground");
acceleratorSelectionForeground = FineUIUtils.getUIColor("MenuItem.toolbar.acceleratorSelectionForeground", "MenuItem.acceleratorSelectionForeground");
}
super.paint(g, c); super.paint(g, c);
} }
} }

6
designer-base/src/main/java/com/fine/theme/light/ui/FinePopupMenuUI.java

@ -1,6 +1,5 @@
package com.fine.theme.light.ui; package com.fine.theme.light.ui;
import com.fine.theme.utils.FineClientProperties;
import com.fine.theme.utils.FineUIUtils; import com.fine.theme.utils.FineUIUtils;
import com.formdev.flatlaf.ui.FlatPopupMenuUI; import com.formdev.flatlaf.ui.FlatPopupMenuUI;
@ -41,11 +40,6 @@ public class FinePopupMenuUI extends FlatPopupMenuUI {
@Override @Override
public void paint(Graphics g, JComponent c) { public void paint(Graphics g, JComponent c) {
Object clientProperty = c.getClientProperty(FineClientProperties.POPUP_MENU_TYPE);
if (clientProperty != null && clientProperty.equals(FineClientProperties.POPUP_MENU_TYPE_TOOL_BAR)) {
c.setBackground(FineUIUtils.getUIColor("PopupMenu.toolbar.background", "PopupMenu.background"));
}
// 绘制圆角矩形作为弹窗背景 // 绘制圆角矩形作为弹窗背景
Graphics2D g2d = (Graphics2D) g; Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

6
designer-base/src/main/java/com/fine/theme/utils/FineClientProperties.java

@ -16,11 +16,13 @@ public interface FineClientProperties extends FlatClientProperties {
String BUTTON_TYPE_LEFT_ROUND_RECT = "leftRoundRect"; String BUTTON_TYPE_LEFT_ROUND_RECT = "leftRoundRect";
String BUTTON_TYPE_RIGHT_ROUND_RECT = "rightRoundRect"; String BUTTON_TYPE_RIGHT_ROUND_RECT = "rightRoundRect";
/**
* 背景透明按钮仅初始化背景不生效悬浮点击仍然生效
*/
String BUTTON_TYPE_TRANSPARENT = "transparentButton";
//--------------------------- PopupMenu ----------------------- //--------------------------- PopupMenu -----------------------
String POPUP_MENU_TYPE = "popupMenuType";
String MENU_ITEM_TYPE = "MenuItemType"; String MENU_ITEM_TYPE = "MenuItemType";
String POPUP_MENU_TYPE_TOOL_BAR = "toolBar";
String MENU_ITEM_TYPE_LOCK = "lock"; String MENU_ITEM_TYPE_LOCK = "lock";
String BUTTON_GROUP_POSITION = "group_position"; String BUTTON_GROUP_POSITION = "group_position";

4
designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java

@ -27,6 +27,10 @@ public interface FineUIStyle {
String BRAND_COLOR_LABEL = "brandColorLabel"; String BRAND_COLOR_LABEL = "brandColorLabel";
String BUTTON_TAB_ACTION = "tabAction"; String BUTTON_TAB_ACTION = "tabAction";
String MENU_TOOL_BAR = "menuToolBar";
String MENU_ITEM_TOOL_BAR = "menuItemToolBar";
String POPUP_MENU_TOOL_BAR = "popupMenuToolBar";
/** /**
* 添加组件的样式类类似css该方法会接在原样式后方 * 添加组件的样式类类似css该方法会接在原样式后方

4
designer-base/src/main/java/com/fr/design/mainframe/JFormSliderPane.java

@ -1,6 +1,7 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fine.theme.icon.LazyIcon; import com.fine.theme.icon.LazyIcon;
import com.fine.theme.utils.FineClientProperties;
import com.fine.theme.utils.FineUIScale; import com.fine.theme.utils.FineUIScale;
import com.fine.theme.utils.FineUIUtils; import com.fine.theme.utils.FineUIUtils;
import com.formdev.flatlaf.ui.FlatUIUtils; import com.formdev.flatlaf.ui.FlatUIUtils;
@ -34,6 +35,7 @@ import java.math.BigDecimal;
import static com.fine.theme.utils.FineUIStyle.LIGHT_GREY; import static com.fine.theme.utils.FineUIStyle.LIGHT_GREY;
import static com.fine.theme.utils.FineUIStyle.setStyle; import static com.fine.theme.utils.FineUIStyle.setStyle;
import static com.formdev.flatlaf.FlatClientProperties.BUTTON_TYPE;
/** /**
@ -106,6 +108,7 @@ public class JFormSliderPane extends JPanel {
}; };
downButton.setBorderPainted(false); downButton.setBorderPainted(false);
downButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Scale_Down")); downButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Scale_Down"));
downButton.putClientProperty(BUTTON_TYPE, FineClientProperties.BUTTON_TYPE_TRANSPARENT);
upButton = new UIButton(new LazyIcon("zoomIn")) { upButton = new UIButton(new LazyIcon("zoomIn")) {
public Point getToolTipLocation(MouseEvent event) { public Point getToolTipLocation(MouseEvent event) {
return new Point(event.getX(), event.getY() - TOOLTIP_Y); return new Point(event.getX(), event.getY() - TOOLTIP_Y);
@ -117,6 +120,7 @@ public class JFormSliderPane extends JPanel {
upButton.setActionCommand("more"); upButton.setActionCommand("more");
downButton.addActionListener(buttonActionListener); downButton.addActionListener(buttonActionListener);
upButton.addActionListener(buttonActionListener); upButton.addActionListener(buttonActionListener);
upButton.putClientProperty(BUTTON_TYPE, FineClientProperties.BUTTON_TYPE_TRANSPARENT);
} }
private void initShowValField() { private void initShowValField() {

4
designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java

@ -1,6 +1,7 @@
package com.fr.design.mainframe.loghandler; package com.fr.design.mainframe.loghandler;
import com.fine.theme.icon.LazyIcon; import com.fine.theme.icon.LazyIcon;
import com.fine.theme.utils.FineClientProperties;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
@ -9,6 +10,8 @@ import java.awt.BorderLayout;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import static com.formdev.flatlaf.FlatClientProperties.BUTTON_TYPE;
/** /**
* 日志消息 * 日志消息
* *
@ -40,6 +43,7 @@ public class LogMessageBar extends BasicPane {
logButton = new UIButton(new LazyIcon("logMsg")); logButton = new UIButton(new LazyIcon("logMsg"));
logButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Show_Log_Message")); logButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Show_Log_Message"));
logButton.set4ToolbarButton(); logButton.set4ToolbarButton();
logButton.putClientProperty(BUTTON_TYPE, FineClientProperties.BUTTON_TYPE_TRANSPARENT);
add(logButton); add(logButton);
logButton.addMouseListener(new MouseAdapter() { logButton.addMouseListener(new MouseAdapter() {
@Override @Override

10
designer-base/src/main/java/com/fr/design/menu/MenuDef.java

@ -1,7 +1,7 @@
package com.fr.design.menu; package com.fr.design.menu;
import com.fine.theme.icon.LazyIcon; import com.fine.theme.icon.LazyIcon;
import com.fine.theme.utils.FineClientProperties; import com.fine.theme.utils.FineUIStyle;
import com.fr.base.svg.IconUtils; import com.fr.base.svg.IconUtils;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
@ -35,6 +35,8 @@ import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import static com.fine.theme.utils.FineUIStyle.setStyle;
/** /**
* Define Menu. * Define Menu.
*/ */
@ -330,18 +332,18 @@ public class MenuDef extends ShortCut {
} }
private void setToolBarClientProperty(JPopupMenu jPopupMenu) { private void setToolBarClientProperty(JPopupMenu jPopupMenu) {
jPopupMenu.putClientProperty(FineClientProperties.POPUP_MENU_TYPE, FineClientProperties.POPUP_MENU_TYPE_TOOL_BAR); setStyle(jPopupMenu, FineUIStyle.POPUP_MENU_TOOL_BAR);
MenuElement[] subElements = jPopupMenu.getSubElements(); MenuElement[] subElements = jPopupMenu.getSubElements();
for (MenuElement subElement : subElements) { for (MenuElement subElement : subElements) {
if (subElement instanceof JMenu) { if (subElement instanceof JMenu) {
JMenu jMenu = (JMenu) subElement; JMenu jMenu = (JMenu) subElement;
jMenu.putClientProperty(FineClientProperties.POPUP_MENU_TYPE, FineClientProperties.POPUP_MENU_TYPE_TOOL_BAR); setStyle(jMenu, FineUIStyle.MENU_TOOL_BAR);
JPopupMenu childPopupMenu = jMenu.getPopupMenu(); JPopupMenu childPopupMenu = jMenu.getPopupMenu();
setToolBarClientProperty(childPopupMenu); setToolBarClientProperty(childPopupMenu);
} else if (subElement instanceof JMenuItem) { } else if (subElement instanceof JMenuItem) {
JMenuItem jMenuItem = (JMenuItem) subElement; JMenuItem jMenuItem = (JMenuItem) subElement;
jMenuItem.putClientProperty(FineClientProperties.POPUP_MENU_TYPE, FineClientProperties.POPUP_MENU_TYPE_TOOL_BAR); setStyle(jMenuItem, FineUIStyle.MENU_ITEM_TOOL_BAR);
} }
} }
} }

4
designer-base/src/main/java/com/fr/design/notification/ui/NotificationCenterPane.java

@ -1,6 +1,7 @@
package com.fr.design.notification.ui; package com.fr.design.notification.ui;
import com.fine.theme.icon.LazyIcon; import com.fine.theme.icon.LazyIcon;
import com.fine.theme.utils.FineClientProperties;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
@ -11,6 +12,8 @@ import java.awt.BorderLayout;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import static com.formdev.flatlaf.FlatClientProperties.BUTTON_TYPE;
public class NotificationCenterPane extends BasicPane { public class NotificationCenterPane extends BasicPane {
private static NotificationCenterPane notificationCenterPane = new NotificationCenterPane(); private static NotificationCenterPane notificationCenterPane = new NotificationCenterPane();
private static UIButton notificationCenterButton; private static UIButton notificationCenterButton;
@ -22,6 +25,7 @@ public class NotificationCenterPane extends BasicPane {
notificationCenterButton.setIcon(new LazyIcon("notification")); notificationCenterButton.setIcon(new LazyIcon("notification"));
notificationCenterButton.setToolTipText(Toolkit.i18nText("Fine-Design_Basic_Show_Notification")); notificationCenterButton.setToolTipText(Toolkit.i18nText("Fine-Design_Basic_Show_Notification"));
notificationCenterButton.set4ToolbarButton(); notificationCenterButton.set4ToolbarButton();
notificationCenterButton.putClientProperty(BUTTON_TYPE, FineClientProperties.BUTTON_TYPE_TRANSPARENT);
this.add(notificationCenterButton); this.add(notificationCenterButton);
notificationCenterButton.addMouseListener(new MouseAdapter() { notificationCenterButton.addMouseListener(new MouseAdapter() {
@Override @Override

24
designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties

@ -455,10 +455,9 @@ Menu.opaque = false
Menu.borderPainted = true Menu.borderPainted = true
Menu.background = @menuBackground Menu.background = @menuBackground
Menu.selectionBackground=$fill.hover Menu.selectionBackground=$fill.hover
Menu.toolbar.selectionBackground=$brand.normal #Menu.selectionForeground=$text.white
Menu.toolbar.selectionForeground=$text.white #Menu.acceleratorForeground=@foreground
Menu.toolbar.acceleratorForeground=@foreground #Menu.acceleratorSelectionForeground=$text.white
Menu.toolbar.acceleratorSelectionForeground=$text.white
#---- MenuBar ---- #---- MenuBar ----
@ -492,15 +491,11 @@ MenuItem.acceleratorArrowGap=4
MenuItem.acceleratorDelimiter = "+" MenuItem.acceleratorDelimiter = "+"
MenuItem.acceleratorForeground=@foreground MenuItem.acceleratorForeground=@foreground
MenuItem.acceleratorSelectionForeground=@foreground MenuItem.acceleratorSelectionForeground=@foreground
MenuItem.toolbar.acceleratorForeground=@foreground
MenuItem.toolbar.acceleratorSelectionForeground=$text.white
[mac]MenuItem.acceleratorDelimiter = "" [mac]MenuItem.acceleratorDelimiter = ""
MenuItem.selectionInsets=0,4,0,4 MenuItem.selectionInsets=0,4,0,4
MenuItem.selectionArc=4 MenuItem.selectionArc=4
MenuItem.selectionBackground=$fill.hover MenuItem.selectionBackground=$fill.hover
MenuItem.selectionForeground=@foreground MenuItem.selectionForeground=@foreground
MenuItem.toolbar.selectionBackground=$brand.normal
MenuItem.toolbar.selectionForeground=$text.white
MenuItem.disabledForeground=fade(@foreground,29%) MenuItem.disabledForeground=fade(@foreground,29%)
# for MenuItem.selectionType = underline # for MenuItem.selectionType = underline
@ -570,7 +565,6 @@ PopupMenu.border=com.fine.theme.light.ui.FinePopupMenuBorder
PopupMenu.borderInsets=10,0,10,0 PopupMenu.borderInsets=10,0,10,0
PopupMenu.borderCornerRadius = $Popup.borderCornerRadius PopupMenu.borderCornerRadius = $Popup.borderCornerRadius
PopupMenu.background=$background.normal PopupMenu.background=$background.normal
PopupMenu.toolbar.background=$fill.gray
PopupMenu.scrollArrowColor = @buttonArrowColor PopupMenu.scrollArrowColor = @buttonArrowColor
PopupMenu.borderColor=$border.divider PopupMenu.borderColor=$border.divider
PopupMenu.hoverScrollArrowBackground = darken(@background,5%) PopupMenu.hoverScrollArrowBackground = darken(@background,5%)
@ -1271,6 +1265,18 @@ CellOtherSetPane.height=$Component.defaultHeight
[style]ToggleButton.inToolbarGroup = \ [style]ToggleButton.inToolbarGroup = \
margin : 4,4,4,4; \ margin : 4,4,4,4; \
background : #fff background : #fff
[style]Menu.menuToolBar=\
selectionBackground : $brand.normal; \
selectionForeground : $text.white; \
acceleratorForeground : @foreground; \
acceleratorSelectionForeground : $text.white
[style]MenuItem.menuItemToolBar=\
selectionBackground : $brand.normal; \
selectionForeground : $text.white; \
acceleratorForeground : @foreground; \
acceleratorSelectionForeground : $text.white
[style]PopupMenu.popupMenuToolBar=\
background: $fill.gray
#---- clearButton ---- #---- clearButton ----
# for clear/cancel button in text fields # for clear/cancel button in text fields

9
designer-base/src/test/java/com/fr/design/gui/storybook/components/PopupMenuStoryBoard.java

@ -1,7 +1,7 @@
package com.fr.design.gui.storybook.components; package com.fr.design.gui.storybook.components;
import com.fine.theme.icon.LazyIcon; import com.fine.theme.icon.LazyIcon;
import com.fine.theme.utils.FineClientProperties; import com.fine.theme.utils.FineUIStyle;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.gui.imenu.UIPopupMenu;
@ -19,6 +19,7 @@ import java.awt.event.MouseEvent;
import static com.fine.swing.ui.layout.Layouts.cell; import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.column; import static com.fine.swing.ui.layout.Layouts.column;
import static com.fine.theme.utils.FineUIStyle.setStyle;
/** /**
* 弹窗组件 * 弹窗组件
@ -83,18 +84,18 @@ public class PopupMenuStoryBoard extends StoryBoard {
private void setToolBarClientProperty(JPopupMenu jPopupMenu) { private void setToolBarClientProperty(JPopupMenu jPopupMenu) {
jPopupMenu.putClientProperty(FineClientProperties.POPUP_MENU_TYPE, FineClientProperties.POPUP_MENU_TYPE_TOOL_BAR); setStyle(jPopupMenu, FineUIStyle.POPUP_MENU_TOOL_BAR);
MenuElement[] subElements = jPopupMenu.getSubElements(); MenuElement[] subElements = jPopupMenu.getSubElements();
for (MenuElement subElement : subElements) { for (MenuElement subElement : subElements) {
if (subElement instanceof JMenu) { if (subElement instanceof JMenu) {
JMenu jMenu = (JMenu) subElement; JMenu jMenu = (JMenu) subElement;
jMenu.putClientProperty(FineClientProperties.POPUP_MENU_TYPE, FineClientProperties.POPUP_MENU_TYPE_TOOL_BAR);
JPopupMenu childPopupMenu = jMenu.getPopupMenu(); JPopupMenu childPopupMenu = jMenu.getPopupMenu();
setStyle(jMenu, FineUIStyle.MENU_TOOL_BAR);
setToolBarClientProperty(childPopupMenu); setToolBarClientProperty(childPopupMenu);
} else if (subElement instanceof JMenuItem) { } else if (subElement instanceof JMenuItem) {
JMenuItem jMenuItem = (JMenuItem) subElement; JMenuItem jMenuItem = (JMenuItem) subElement;
jMenuItem.putClientProperty(FineClientProperties.POPUP_MENU_TYPE, FineClientProperties.POPUP_MENU_TYPE_TOOL_BAR); setStyle(jMenuItem, FineUIStyle.MENU_ITEM_TOOL_BAR);
} }
} }
} }

4
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java

@ -1,6 +1,7 @@
package com.fr.design.mainframe.alphafine.component; package com.fr.design.mainframe.alphafine.component;
import com.fine.theme.icon.LazyIcon; import com.fine.theme.icon.LazyIcon;
import com.fine.theme.utils.FineClientProperties;
import com.fr.design.actions.help.alphafine.AlphaFineContext; import com.fr.design.actions.help.alphafine.AlphaFineContext;
import com.fr.design.actions.help.alphafine.AlphaFineListener; import com.fr.design.actions.help.alphafine.AlphaFineListener;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
@ -13,6 +14,8 @@ import java.awt.Toolkit;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import static com.formdev.flatlaf.FlatClientProperties.BUTTON_TYPE;
/** /**
* Created by XiaXiang on 2017/3/21. * Created by XiaXiang on 2017/3/21.
*/ */
@ -29,6 +32,7 @@ public class AlphaFinePane extends BasicPane {
UIButton refreshButton = new UIButton(); UIButton refreshButton = new UIButton();
refreshButton.setIcon(new LazyIcon(("search"))); refreshButton.setIcon(new LazyIcon(("search")));
refreshButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Learn_More_About")); refreshButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Learn_More_About"));
refreshButton.putClientProperty(BUTTON_TYPE, FineClientProperties.BUTTON_TYPE_TRANSPARENT);
refreshButton.set4ToolbarButton(); refreshButton.set4ToolbarButton();
this.add(refreshButton); this.add(refreshButton);
refreshButton.addActionListener(new ActionListener() { refreshButton.addActionListener(new ActionListener() {

Loading…
Cancel
Save