Browse Source

REPORT-60812 【主题切换】主题面板的框框显示有点出入

【问题原因】
调整设计器Tab组件边框颜色

【改动思路】
同上
bugfix/11.0
Starryi 3 years ago
parent
commit
844e179040
  1. 12
      designer-base/src/main/java/com/fr/design/gui/frpane/UITabbedPane.java
  2. 21
      designer-base/src/main/java/com/fr/design/gui/frpane/UITabbedPaneUI.java
  3. 1
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPagesPane.java

12
designer-base/src/main/java/com/fr/design/gui/frpane/UITabbedPane.java

@ -21,6 +21,8 @@ public class UITabbedPane extends JTabbedPane{
private String classPath; //panel对象的类名 private String classPath; //panel对象的类名
private String tabName; //Tab名称 private String tabName; //Tab名称
private int tabSize = 0; private int tabSize = 0;
private Color tabBorderColor;
public UITabbedPane() { public UITabbedPane() {
super(); super();
} }
@ -93,6 +95,16 @@ public class UITabbedPane extends JTabbedPane{
public int getTabSize(){ public int getTabSize(){
return tabSize; return tabSize;
} }
public Color getTabBorderColor() {
return tabBorderColor;
}
public void setTabBorderColor(Color tabBorderColor) {
this.tabBorderColor = tabBorderColor;
repaint();
}
@Override @Override
/** /**
* 获取UI对象 * 获取UI对象

21
designer-base/src/main/java/com/fr/design/gui/frpane/UITabbedPaneUI.java

@ -31,9 +31,20 @@ public class UITabbedPaneUI extends BasicTabbedPaneUI {
private int addX = -1; private int addX = -1;
private int addY = -1; private int addY = -1;
private int rollover = -1; private int rollover = -1;
private Color tabBorderColor = new Color(143, 160, 183); private final Color DEFAULT_TAB_BORDER_COLOR = new Color(143, 160, 183);
private Color[] tabSelectedColor = {UIConstants.NORMAL_BLUE, UIConstants.NORMAL_BLUE, UIConstants.NORMAL_BLUE}; private Color[] tabSelectedColor = {UIConstants.NORMAL_BLUE, UIConstants.NORMAL_BLUE, UIConstants.NORMAL_BLUE};
public Color getTabBorderColor() {
Color color = null;
if (tabPane instanceof UITabbedPane) {
color = ((UITabbedPane) tabPane).getTabBorderColor();
}
if (color == null) {
color = DEFAULT_TAB_BORDER_COLOR;
}
return color;
}
/** /**
* 创建UI对象 * 创建UI对象
* *
@ -252,9 +263,9 @@ public class UITabbedPaneUI extends BasicTabbedPaneUI {
private void drawUITabBorder(Graphics g, int tabPlacement, int x, int y, int w, int h, private void drawUITabBorder(Graphics g, int tabPlacement, int x, int y, int w, int h,
boolean isSelected, boolean isEnabled, boolean isRollover) { boolean isSelected, boolean isEnabled, boolean isRollover) {
if (!isEnabled) { if (!isEnabled) {
drawUITabBorder(g, tabBorderColor, x, y, w, h, tabPlacement); drawUITabBorder(g, getTabBorderColor(), x, y, w, h, tabPlacement);
} else if (isSelected || isRollover) { } else if (isSelected || isRollover) {
drawSelectedUITabBorder(g, tabBorderColor, x, y, w, h, tabPlacement); drawSelectedUITabBorder(g, getTabBorderColor(), x, y, w, h, tabPlacement);
if (isRollover && canClose()) { if (isRollover && canClose()) {
closeX = x + w - closeIcon.getIconWidth() - 3; closeX = x + w - closeIcon.getIconWidth() - 3;
closeY = 0; closeY = 0;
@ -269,7 +280,7 @@ public class UITabbedPaneUI extends BasicTabbedPaneUI {
closeIcon.paintIcon(tabPane, g, closeX, closeY); closeIcon.paintIcon(tabPane, g, closeX, closeY);
} }
} else { } else {
drawUITabBorder(g, tabBorderColor, x, y, w, h, tabPlacement); drawUITabBorder(g, getTabBorderColor(), x, y, w, h, tabPlacement);
} }
} }
@ -322,7 +333,7 @@ public class UITabbedPaneUI extends BasicTabbedPaneUI {
} }
private void drawUIContentBorder(Graphics g, int x, int y, int w, int h) { private void drawUIContentBorder(Graphics g, int x, int y, int w, int h) {
g.setColor(tabBorderColor); g.setColor(getTabBorderColor());
g.drawRect(x, y, w - 3, h - 3); g.drawRect(x, y, w - 3, h - 3);
// Shadow // Shadow
g.setColor(new Color(204, 204, 204)); g.setColor(new Color(204, 204, 204));

1
designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPagesPane.java

@ -293,6 +293,7 @@ public class TemplateThemeGridPagesPane extends JPanel {
setLayout(FRGUIPaneFactory.createBorderLayout()); setLayout(FRGUIPaneFactory.createBorderLayout());
tabbedPane = new UITabbedPane(); tabbedPane = new UITabbedPane();
tabbedPane.setTabBorderColor(new Color(0xE0E0E1));
add(tabbedPane, BorderLayout.CENTER); add(tabbedPane, BorderLayout.CENTER);
formThemesManagerPane = TemplateThemeGridControlPane.createFormThemesManagerPane(); formThemesManagerPane = TemplateThemeGridControlPane.createFormThemesManagerPane();

Loading…
Cancel
Save