From 213fdad3fb26258ba13496ee2d1bcdc98abe687c Mon Sep 17 00:00:00 2001 From: plough Date: Thu, 12 Oct 2017 10:55:22 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-4887=20@plough=EF=BC=9A9.0=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8=E4=BA=A4=E4=BA=92=E9=AA=8C=E6=94=B6=E9=97=AE?= =?UTF-8?q?=E9=A2=98=3D>=E8=81=9A=E5=90=88=E8=A1=A8=3D=E3=80=8B=E8=81=9A?= =?UTF-8?q?=E5=90=88=E5=9D=97=E6=8C=89=E9=92=AE=E9=A2=9C=E8=89=B2=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/poly/creator/BlockEditor.java | 33 ++++++++++++++----- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/designer/src/com/fr/poly/creator/BlockEditor.java b/designer/src/com/fr/poly/creator/BlockEditor.java index 12f142dce9..636b134ed2 100644 --- a/designer/src/com/fr/poly/creator/BlockEditor.java +++ b/designer/src/com/fr/poly/creator/BlockEditor.java @@ -3,17 +3,16 @@ */ package com.fr.poly.creator; -import java.awt.Color; -import java.awt.Cursor; -import java.awt.Dimension; -import java.awt.Graphics; -import java.awt.Rectangle; +import java.awt.*; import javax.swing.JComponent; +import javax.swing.plaf.ButtonUI; import com.fr.base.ScreenResolution; import com.fr.design.beans.location.Absorptionline; import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.ibutton.UIButtonUI; +import com.fr.design.utils.gui.GUIPaintUtils; import com.fr.design.utils.gui.LayoutUtils; import com.fr.general.ComparatorUtils; import com.fr.poly.PolyConstants; @@ -65,15 +64,15 @@ public abstract class BlockEditor editComponent = createEffective(); this.add(BlockEditorLayout.CENTER, editComponent); - this.addHeightTool = new UIButton(); + this.addHeightTool = new BlockControlButton(); this.add(BlockEditorLayout.LEFTBOTTOM, this.addHeightTool); this.addHeightTool.setPreferredSize(getAddHeigthPreferredSize()); - this.addWidthTool = new UIButton(); + this.addWidthTool = new BlockControlButton(); this.add(BlockEditorLayout.RIGHTTOP, this.addWidthTool); this.addWidthTool.setPreferredSize(getAddWidthPreferredSize()); - this.moveTool = new UIButton(); + this.moveTool = new BlockControlButton(); this.add(BlockEditorLayout.BOTTOMCORNER, this.moveTool); this.forbiddenWindow = new BlockForbiddenWindow(); @@ -204,5 +203,21 @@ public abstract class BlockEditor return new Dimension(); } - + private class BlockControlButton extends UIButton { + @Override + public ButtonUI getUI() { + return new UIButtonUI() { + // 调换 normal 和 rollover 状态的填充色 + 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)); + } else if (isRollOver(b)) { + GUIPaintUtils.fillNormal(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted()); + } else if (b.isNormalPainted()) { + GUIPaintUtils.fillRollOver(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted()); + } + } + }; + } + } } \ No newline at end of file