Browse Source

Merging in latest from upstream (ST/design:refs/heads/feature/9.0)

* commit 'f1adb37b5e7c5e7d87fc113ce6a2d823ab860546':
  REPORT-5508 加回边框
master
MoMeak 7 years ago
parent
commit
7f138bb219
  1. 34
      designer_base/src/com/fr/design/gui/ibutton/UIButtonGroup.java

34
designer_base/src/com/fr/design/gui/ibutton/UIButtonGroup.java

@ -218,11 +218,11 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
} }
protected Border getGroupBorder() { protected Border getGroupBorder() {
return BorderFactory.createEmptyBorder(0, 0, 0, 0); return BorderFactory.createEmptyBorder(1, 1, 1, 1);
} }
protected LayoutManager getGridLayout(int number) { 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<T> extends JPanel implements GlobalNameObserver {
public void paintComponents(Graphics g) { public void paintComponents(Graphics g) {
Graphics2D g2d = (Graphics2D) g; Graphics2D g2d = (Graphics2D) g;
Shape oldClip = g2d.getClip(); 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); super.paintComponents(g);
g2d.setClip(oldClip); g2d.setClip(oldClip);
} }
@ -394,6 +394,34 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
fireStateChanged(); 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 * main
* *

Loading…
Cancel
Save