From ef85a7de88c1ac3dc5d212b5a976a02fc5b05d53 Mon Sep 17 00:00:00 2001 From: hzzz Date: Thu, 14 Sep 2017 11:08:43 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=9D=A1=E4=BB=B6=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E8=83=8C=E6=99=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/gui/controlpane/UIListControlPane.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java b/designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java index 81165a2b9..617619bc2 100644 --- a/designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java +++ b/designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java @@ -6,6 +6,7 @@ import com.fr.base.chart.BasePlot; import com.fr.design.actions.UpdateAction; import com.fr.design.actions.core.ActionFactory; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.constants.UIConstants; import com.fr.design.data.tabledata.tabledatapane.GlobalMultiTDTableDataPane; import com.fr.design.data.tabledata.tabledatapane.GlobalTreeTableDataPane; import com.fr.design.data.tabledata.tabledatapane.MultiTDTableDataPane; @@ -87,6 +88,7 @@ public abstract class UIListControlPane extends UIControlPane { protected void initLeftPane(JPanel leftPane) { nameableList = createJNameList(); nameableList.setName(LIST_NAME); + nameableList.setSelectionBackground(UIConstants.ATTRIBUTE_PRESS); leftPane.add(new UIScrollPane(nameableList), BorderLayout.CENTER); From a29ef9af71dbfc5f6a139d0d612659ab1485e5d4 Mon Sep 17 00:00:00 2001 From: hzzz Date: Thu, 14 Sep 2017 11:43:13 +0800 Subject: [PATCH 2/4] =?UTF-8?q?ToolbarUI=E8=83=8C=E6=99=AF=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_base/src/com/fr/design/gui/itoolbar/UIToolBarUI.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/designer_base/src/com/fr/design/gui/itoolbar/UIToolBarUI.java b/designer_base/src/com/fr/design/gui/itoolbar/UIToolBarUI.java index d9d5bf7ed..8d3a66d45 100644 --- a/designer_base/src/com/fr/design/gui/itoolbar/UIToolBarUI.java +++ b/designer_base/src/com/fr/design/gui/itoolbar/UIToolBarUI.java @@ -25,6 +25,8 @@ import com.fr.design.constants.UIConstants; import com.fr.design.gui.ibutton.UIToolButtonBorder; import com.fr.design.gui.icheckbox.UICheckBox; +import static com.fr.design.utils.ThemeUtils.BACK_COLOR; + public class UIToolBarUI extends MetalToolBarUI { public static final String IS_TOOL_BAR_BUTTON_KEY = "JToolBar.isToolbarButton"; public static final int FLOATABLE_GRIP_SIZE = 8; @@ -89,7 +91,7 @@ public class UIToolBarUI extends MetalToolBarUI { */ public void paint(Graphics g, JComponent c) { Graphics2D g2 = (Graphics2D) g; - g2.setColor(UIConstants.TOOLBARUI_BACKGROUND); + g2.setColor(BACK_COLOR); g2.fillRect(0, 0, c.getWidth(), c.getHeight()); } From fca6bc07e68290a79afa5d882f3a6e1d7842def5 Mon Sep 17 00:00:00 2001 From: hzzz Date: Thu, 14 Sep 2017 12:25:04 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=B8=8B=E6=8B=89=E6=A1=86=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E7=9A=84=E9=A2=9C=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/constants/UIConstants.java | 3 + .../com/fr/design/gui/ibutton/UIButtonUI.java | 6 +- .../fr/design/utils/gui/GUIPaintUtils.java | 84 ++++++++++--------- 3 files changed, 52 insertions(+), 41 deletions(-) diff --git a/designer_base/src/com/fr/design/constants/UIConstants.java b/designer_base/src/com/fr/design/constants/UIConstants.java index 39ea2e6fb..b675b40d8 100644 --- a/designer_base/src/com/fr/design/constants/UIConstants.java +++ b/designer_base/src/com/fr/design/constants/UIConstants.java @@ -64,6 +64,9 @@ public interface UIConstants { Constants.LINE_MEDIUM_DASH_DOT_DOT, //medium dash-dot-dot border Constants.LINE_SLANTED_DASH_DOT, //slanted dash-dot border }; + public static final Color COMBOBOX_BTN_NORMAL = new Color(0xD9DADD); + public static final Color COMBOBOX_BTN_ROLLOVER = new Color(0xC8C9CD); + public static final Color COMBOBOX_BTN_PRESS = new Color(0xD8F2FD); public static final Color LINE_COLOR = new Color(153, 153, 153); public static final Color FONT_COLOR = new Color(51, 51, 51); public static final Color LIGHT_BLUE = new Color(182, 217, 253); diff --git a/designer_base/src/com/fr/design/gui/ibutton/UIButtonUI.java b/designer_base/src/com/fr/design/gui/ibutton/UIButtonUI.java index ee98d0928..cd76c30cb 100644 --- a/designer_base/src/com/fr/design/gui/ibutton/UIButtonUI.java +++ b/designer_base/src/com/fr/design/gui/ibutton/UIButtonUI.java @@ -51,11 +51,11 @@ public class UIButtonUI extends BasicButtonUI { protected void doExtraPainting(UIButton b, Graphics2D g2d, int w, int h, String selectedRoles) { if (isPressed(b) && b.isPressedPainted()) { - GUIPaintUtils.fillPressed(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles)); + GUIPaintUtils.fillPressed(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), UIConstants.COMBOBOX_BTN_PRESS); } else if (isRollOver(b)) { - GUIPaintUtils.fillRollOver(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted()); + GUIPaintUtils.fillRollOver(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted(), UIConstants.COMBOBOX_BTN_ROLLOVER); } else if (b.isNormalPainted()) { - GUIPaintUtils.fillNormal(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted()); + GUIPaintUtils.fillNormal(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted(), UIConstants.COMBOBOX_BTN_NORMAL); } } diff --git a/designer_base/src/com/fr/design/utils/gui/GUIPaintUtils.java b/designer_base/src/com/fr/design/utils/gui/GUIPaintUtils.java index fb21725d6..286e44cd6 100644 --- a/designer_base/src/com/fr/design/utils/gui/GUIPaintUtils.java +++ b/designer_base/src/com/fr/design/utils/gui/GUIPaintUtils.java @@ -49,23 +49,28 @@ public class GUIPaintUtils { /** * 正常状态填充 - * @param g2d 图形对象 - * @param x x坐标 - * @param y y坐标 - * @param width 宽度 - * @param height 高度 - * @param isRound 是否圆角 - * @param rectDirection 矩形方向 + * + * @param g2d 图形对象 + * @param x x坐标 + * @param y y坐标 + * @param width 宽度 + * @param height 高度 + * @param isRound 是否圆角 + * @param rectDirection 矩形方向 * @param isAuthorityEdited 是否权限编辑 - * @param isPressedPainted 是否按压画 + * @param isPressedPainted 是否按压画 */ public static final void fillNormal(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection, boolean isAuthorityEdited, boolean isPressedPainted) { + fillNormal(g2d, x, y, width, height, isRound, rectDirection, isAuthorityEdited, isPressedPainted, UIConstants.ATTRIBUTE_NORMAL); + } + + public static final void fillNormal(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection, boolean isAuthorityEdited, boolean isPressedPainted, Color color) { GradientPaint gp; if (BaseUtils.isAuthorityEditing() && isAuthorityEdited) { gp = new GradientPaint(1, 1, UIConstants.AUTHORITY_BLUE, 1, height - 1, UIConstants.AUTHORITY_DARK_BLUE); } else if (isPressedPainted) { - gp = new GradientPaint(1, 1, UIConstants.ATTRIBUTE_NORMAL, 1, height - 1, UIConstants.ATTRIBUTE_NORMAL); - }else{ + gp = new GradientPaint(1, 1, color, 1, height - 1, color); + } else { gp = new GradientPaint(1, 1, UIConstants.SHADOW_GREY, 1, height - 1, UIConstants.SHADOW_GREY); } @@ -74,15 +79,16 @@ public class GUIPaintUtils { /** * 鼠标悬停状态填充 - * @param g2d 图形对象 - * @param x x坐标 - * @param y y坐标 - * @param width 宽度 - * @param height 高度 - * @param isRound 是否圆角 - * @param rectDirection 矩形方向 + * + * @param g2d 图形对象 + * @param x x坐标 + * @param y y坐标 + * @param width 宽度 + * @param height 高度 + * @param isRound 是否圆角 + * @param rectDirection 矩形方向 * @param isAuthorityEdited 是否权限编辑 - * @param isPressedPainted 是否按压画 + * @param isPressedPainted 是否按压画 */ public static final void fillRollOver(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection, boolean isAuthorityEdited, boolean isPressedPainted) { fillRollOver(g2d, x, y, width, height, isRound, rectDirection, isAuthorityEdited, isPressedPainted, null); @@ -104,15 +110,15 @@ public class GUIPaintUtils { /** * 按压状态填充 - * @param g2d 图形对象 - * @param x x坐标 - * @param y y坐标 - * @param width 宽度 - * @param height 高度 - * @param isRound 是否圆角 - * @param rectDirection 矩形方向 - * @param isAuthorityEdited 是否权限编辑 * + * @param g2d 图形对象 + * @param x x坐标 + * @param y y坐标 + * @param width 宽度 + * @param height 高度 + * @param isRound 是否圆角 + * @param rectDirection 矩形方向 + * @param isAuthorityEdited 是否权限编辑 */ public static final void fillPressed(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection, boolean isAuthorityEdited) { fillPressed(g2d, x, y, width, height, isRound, rectDirection, isAuthorityEdited, null); @@ -147,17 +153,19 @@ public class GUIPaintUtils { g2d.setColor(oldColor); } + /** * 自定义画笔填充 - * @param g2d 图形对象 - * @param x x坐标 - * @param y y坐标 - * @param width 宽度 - * @param height 高度 - * @param isRound 是否圆角 - * @param rectDirection 矩形方向 - * @param paint 画笔 - * @param arc 圆角尺寸 + * + * @param g2d 图形对象 + * @param x x坐标 + * @param y y坐标 + * @param width 宽度 + * @param height 高度 + * @param isRound 是否圆角 + * @param rectDirection 矩形方向 + * @param paint 画笔 + * @param arc 圆角尺寸 */ public static final void fillPaint(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection, Paint paint, int arc) { Paint oldPaint = g2d.getPaint(); @@ -188,9 +196,9 @@ public class GUIPaintUtils { public static final void paintBorderShadow(Graphics2D g2, int shadowWidth, Shape shape, Color outColor, Color inColor) { g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - g2.setColor(outColor); - g2.setStroke(new BasicStroke(shadowWidth)); - g2.draw(shape); + g2.setColor(outColor); + g2.setStroke(new BasicStroke(shadowWidth)); + g2.draw(shape); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); } From 9f5f83c8783ee0431d50b3678417050f7f1842b2 Mon Sep 17 00:00:00 2001 From: hzzz Date: Thu, 14 Sep 2017 14:38:40 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E4=B8=8B=E6=8B=89=E6=A1=86=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E9=9D=9E=E7=82=B9=E5=87=BB=E7=8A=B6=E6=80=81=E9=A2=9C?= =?UTF-8?q?=E8=89=B2=20&=20=E4=B8=8B=E6=8B=89=E6=A1=86=E9=80=89=E9=A1=B9?= =?UTF-8?q?=E8=83=8C=E6=99=AF=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/ibutton/UIButtonUI.java | 29 ++++++------------- .../gui/icombobox/UIComboBoxRenderer.java | 2 +- 2 files changed, 10 insertions(+), 21 deletions(-) diff --git a/designer_base/src/com/fr/design/gui/ibutton/UIButtonUI.java b/designer_base/src/com/fr/design/gui/ibutton/UIButtonUI.java index cd76c30cb..a38011208 100644 --- a/designer_base/src/com/fr/design/gui/ibutton/UIButtonUI.java +++ b/designer_base/src/com/fr/design/gui/ibutton/UIButtonUI.java @@ -1,27 +1,16 @@ package com.fr.design.gui.ibutton; -import java.awt.FontMetrics; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.Insets; -import java.awt.Rectangle; -import java.awt.RenderingHints; - -import javax.swing.AbstractButton; -import javax.swing.ButtonModel; -import javax.swing.Icon; -import javax.swing.JComponent; -import javax.swing.SwingUtilities; -import javax.swing.plaf.basic.BasicButtonUI; -import javax.swing.plaf.basic.BasicHTML; -import javax.swing.text.View; - import com.fr.design.constants.UIConstants; import com.fr.design.roleAuthority.ReportAndFSManagePane; +import com.fr.design.utils.gui.GUIPaintUtils; +import com.fr.stable.StringUtils; import sun.swing.SwingUtilities2; -import com.fr.stable.StringUtils; -import com.fr.design.utils.gui.GUIPaintUtils; +import javax.swing.*; +import javax.swing.plaf.basic.BasicButtonUI; +import javax.swing.plaf.basic.BasicHTML; +import javax.swing.text.View; +import java.awt.*; public class UIButtonUI extends BasicButtonUI { @@ -66,7 +55,7 @@ public class UIButtonUI extends BasicButtonUI { protected boolean isPressed(AbstractButton b) { ButtonModel model = b.getModel(); - return (model.isArmed() && model.isPressed()) || b.isSelected(); + return model.isArmed() && model.isPressed(); } private void paintContent(Graphics g, AbstractButton b, String text) { @@ -127,7 +116,7 @@ public class UIButtonUI extends BasicButtonUI { return; } Icon selectedIcon = null; - /* the fallback icon should be based on the selected state */ + /* the fallback icon should be based on the selected state */ if (model.isSelected()) { selectedIcon = (Icon) b.getSelectedIcon(); if (selectedIcon != null) { diff --git a/designer_base/src/com/fr/design/gui/icombobox/UIComboBoxRenderer.java b/designer_base/src/com/fr/design/gui/icombobox/UIComboBoxRenderer.java index 7674b574f..4be4fdcf0 100644 --- a/designer_base/src/com/fr/design/gui/icombobox/UIComboBoxRenderer.java +++ b/designer_base/src/com/fr/design/gui/icombobox/UIComboBoxRenderer.java @@ -27,7 +27,7 @@ public class UIComboBoxRenderer extends DefaultListCellRenderer { cellHasFocus = cellHasFocus && !this.isEnabled(); JLabel renderer =(JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); renderer.setForeground(Color.black); - list.setSelectionBackground(UIConstants.FLESH_BLUE); + list.setSelectionBackground(UIConstants.COMBOBOX_BTN_PRESS); list.setSelectionForeground(Color.black); renderer.setText(" " + renderer.getText()); return renderer;