Browse Source

REPORT-107973 回退透明按钮

newui
Leo.Qin 10 months ago
parent
commit
af57758152
  1. 53
      designer-base/src/main/java/com/fine/theme/light/ui/FineButtonUI.java
  2. 4
      designer-base/src/main/java/com/fine/theme/utils/FineClientProperties.java
  3. 4
      designer-base/src/main/java/com/fr/design/mainframe/JFormSliderPane.java
  4. 4
      designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java
  5. 4
      designer-base/src/main/java/com/fr/design/notification/ui/NotificationCenterPane.java
  6. 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,7 +6,6 @@ import com.formdev.flatlaf.ui.FlatButtonUI;
import com.formdev.flatlaf.ui.FlatUIUtils;
import javax.swing.AbstractButton;
import javax.swing.ButtonModel;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.plaf.ComponentUI;
@ -97,58 +96,6 @@ 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
*/

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

@ -16,10 +16,6 @@ public interface FineClientProperties extends FlatClientProperties {
String BUTTON_TYPE_LEFT_ROUND_RECT = "leftRoundRect";
String BUTTON_TYPE_RIGHT_ROUND_RECT = "rightRoundRect";
/**
* 背景透明按钮仅初始化背景不生效悬浮点击仍然生效
*/
String BUTTON_TYPE_TRANSPARENT = "transparentButton";
//--------------------------- PopupMenu -----------------------
String MENU_ITEM_TYPE = "MenuItemType";

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

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

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

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

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

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

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

@ -1,7 +1,6 @@
package com.fr.design.mainframe.alphafine.component;
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.AlphaFineListener;
import com.fr.design.dialog.BasicPane;
@ -14,8 +13,6 @@ import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import static com.formdev.flatlaf.FlatClientProperties.BUTTON_TYPE;
/**
* Created by XiaXiang on 2017/3/21.
*/
@ -32,7 +29,6 @@ public class AlphaFinePane extends BasicPane {
UIButton refreshButton = new UIButton();
refreshButton.setIcon(new LazyIcon(("search")));
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();
this.add(refreshButton);
refreshButton.addActionListener(new ActionListener() {

Loading…
Cancel
Save