From 317be4b0d5839fdd549b05f350abde193d51a781 Mon Sep 17 00:00:00 2001 From: hzzz Date: Mon, 27 Nov 2017 15:48:38 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-5508=20=E5=8A=A0=E5=9B=9E=E8=BE=B9?= =?UTF-8?q?=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/gui/ibutton/UIButtonGroup.java | 34 +++++++++++++++++-- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/designer_base/src/com/fr/design/gui/ibutton/UIButtonGroup.java b/designer_base/src/com/fr/design/gui/ibutton/UIButtonGroup.java index 76828e38e7..d2e2b8d1d9 100644 --- a/designer_base/src/com/fr/design/gui/ibutton/UIButtonGroup.java +++ b/designer_base/src/com/fr/design/gui/ibutton/UIButtonGroup.java @@ -218,11 +218,11 @@ public class UIButtonGroup extends JPanel implements GlobalNameObserver { } protected Border getGroupBorder() { - return BorderFactory.createEmptyBorder(0, 0, 0, 0); + return BorderFactory.createEmptyBorder(1, 1, 1, 1); } protected LayoutManager getGridLayout(int number) { - return new GridLayout(0, number, 0, 0); + return new GridLayout(0, number, 1, 0); } /** @@ -233,7 +233,7 @@ public class UIButtonGroup extends JPanel implements GlobalNameObserver { public void paintComponents(Graphics g) { Graphics2D g2d = (Graphics2D) g; Shape oldClip = g2d.getClip(); - g2d.clip(new RoundRectangle2D.Double(0, 0, getWidth(), getHeight(), UIConstants.ARC, UIConstants.ARC)); + g2d.clip(new RoundRectangle2D.Double(1, 1, getWidth(), getHeight(), UIConstants.ARC, UIConstants.ARC)); super.paintComponents(g); g2d.setClip(oldClip); } @@ -394,6 +394,34 @@ public class UIButtonGroup extends JPanel implements GlobalNameObserver { fireStateChanged(); } + /** + * 重载Border画法 + * + * @param g + */ + @Override + protected void paintBorder(Graphics g) { + if (isToolBarComponent) { + return; + } + Graphics2D g2d = (Graphics2D) g; + g2d.setColor(UIConstants.SHADOW_GREY); + + int width = 0; + for (int i = 0; i < labelButtonList.size() - 1; i++) { + width += labelButtonList.get(i).getWidth() + 1; + int height = labelButtonList.get(i).getHeight(); + g.drawLine(width, 0, width, height); + } + + width += labelButtonList.get(labelButtonList.size() - 1).getWidth() + 1; + + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + g2d.drawRoundRect(0, 0, width, getHeight() - 1, UIConstants.BUTTON_GROUP_ARC, UIConstants.BUTTON_GROUP_ARC); + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); + + } + /** * main *