From f6e3985d928023f473c0cbaf21bb94dfaf49fd30 Mon Sep 17 00:00:00 2001 From: "alex.sung" Date: Thu, 5 Sep 2019 17:28:31 +0800 Subject: [PATCH] =?UTF-8?q?sonar=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/gui/ibutton/UIBasicButtonUI.java | 6 +++--- .../src/main/java/com/fr/design/gui/ibutton/UIButton.java | 2 +- .../main/java/com/fr/design/gui/ibutton/UISliderButton.java | 2 +- .../java/com/fr/design/gui/ibutton/UISliderButtonUI.java | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIBasicButtonUI.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIBasicButtonUI.java index 185e4c18f..64db1e91d 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIBasicButtonUI.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIBasicButtonUI.java @@ -321,9 +321,9 @@ public class UIBasicButtonUI extends MetalButtonUI { //harry: 画带有高光的按钮。 private void drawHighLightButton(Graphics2D g2, Color color1, Color color2, int w, int h) { - GradientPaint buttonPaint = new GradientPaint(0, 0, color1, 0, h - 1, color2); - GradientPaint buttonHighLightPaint = new GradientPaint(0, 0, new Color(1.0f, 1.0f, 1.0f, 0.6f), 0, h / 2, new Color(1.0f, 1.0f, 1.0f, 0.2f)); - GradientPaint buttonHighLightLinePaint = new GradientPaint(1, 1, new Color(1.0f, 1.0f, 1.0f, 0.8f), 0, h / 2, new Color(1.0f, 1.0f, 1.0f, 0.4f)); + GradientPaint buttonPaint = new GradientPaint(0, 0, color1, 0, h - 1f, color2); + GradientPaint buttonHighLightPaint = new GradientPaint(0, 0, new Color(1.0f, 1.0f, 1.0f, 0.6f), 0, h / 2f, new Color(1.0f, 1.0f, 1.0f, 0.2f)); + GradientPaint buttonHighLightLinePaint = new GradientPaint(1, 1, new Color(1.0f, 1.0f, 1.0f, 0.8f), 0, h / 2f, new Color(1.0f, 1.0f, 1.0f, 0.4f)); g2.setPaint(buttonPaint); g2.fillRoundRect(0, 0, w - 1, h - 1, 3, 3); g2.setPaint(buttonHighLightLinePaint);//按钮内侧高光线(内发光,0%阻塞) diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButton.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButton.java index 078bf692b..32f20ad56 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButton.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButton.java @@ -251,7 +251,7 @@ public class UIButton extends JButton implements UIObserver, UITextComponent { protected void paintOtherBorder(Graphics g) { Graphics2D g2d = (Graphics2D) g; g2d.setStroke(borderStroke); - Shape shape = new RoundRectangle2D.Float(0.5f, 0.5f, getWidth() - 1, getHeight() - 1, UIConstants.ARC, UIConstants.ARC); + Shape shape = new RoundRectangle2D.Float(0.5f, 0.5f, getWidth() - 1f, getHeight() - 1f, UIConstants.ARC, UIConstants.ARC); g2d.setColor(borderColor); g2d.draw(shape); } diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UISliderButton.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UISliderButton.java index 21c5ee4b9..cc8aa9f63 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UISliderButton.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UISliderButton.java @@ -232,7 +232,7 @@ public class UISliderButton extends JButton implements UIObserver { protected void paintOtherBorder(Graphics g) { Graphics2D g2d = (Graphics2D) g; g2d.setStroke(borderStroke); - Shape shape = new RoundRectangle2D.Float(0.5f, 0.5f, getWidth() - 1, getHeight() - 1, UIConstants.ARC, UIConstants.ARC); + Shape shape = new RoundRectangle2D.Float(0.5f, 0.5f, getWidth() - 1f, getHeight() - 1f, UIConstants.ARC, UIConstants.ARC); g2d.setColor(borderColor); g2d.draw(shape); } diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UISliderButtonUI.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UISliderButtonUI.java index 6da878d8d..6a92f5057 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UISliderButtonUI.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UISliderButtonUI.java @@ -176,7 +176,7 @@ public class UISliderButtonUI extends BasicButtonUI { private void fillNormal(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection, boolean isAuthorityEdited, boolean isPressedPainted) { GradientPaint gp; if (DesignerMode.isAuthorityEditing() && isAuthorityEdited) { - gp = new GradientPaint(1, 1, UIConstants.AUTHORITY_BLUE, 1, height - 1, UIConstants.AUTHORITY_DARK_BLUE); + gp = new GradientPaint(1, 1, UIConstants.AUTHORITY_BLUE, 1, height - 1f, UIConstants.AUTHORITY_DARK_BLUE); } else if (isPressedPainted) { gp = new GradientPaint(1, 1, UIConstants.SELECT_TAB, 1, height - 1, UIConstants.SELECT_TAB); }else{