Browse Source

下拉框按钮的颜色

master
hzzz 7 years ago
parent
commit
fca6bc07e6
  1. 3
      designer_base/src/com/fr/design/constants/UIConstants.java
  2. 6
      designer_base/src/com/fr/design/gui/ibutton/UIButtonUI.java
  3. 14
      designer_base/src/com/fr/design/utils/gui/GUIPaintUtils.java

3
designer_base/src/com/fr/design/constants/UIConstants.java

@ -64,6 +64,9 @@ public interface UIConstants {
Constants.LINE_MEDIUM_DASH_DOT_DOT, //medium dash-dot-dot border Constants.LINE_MEDIUM_DASH_DOT_DOT, //medium dash-dot-dot border
Constants.LINE_SLANTED_DASH_DOT, //slanted dash-dot border Constants.LINE_SLANTED_DASH_DOT, //slanted dash-dot border
}; };
public static final Color COMBOBOX_BTN_NORMAL = new Color(0xD9DADD);
public static final Color COMBOBOX_BTN_ROLLOVER = new Color(0xC8C9CD);
public static final Color COMBOBOX_BTN_PRESS = new Color(0xD8F2FD);
public static final Color LINE_COLOR = new Color(153, 153, 153); public static final Color LINE_COLOR = new Color(153, 153, 153);
public static final Color FONT_COLOR = new Color(51, 51, 51); public static final Color FONT_COLOR = new Color(51, 51, 51);
public static final Color LIGHT_BLUE = new Color(182, 217, 253); public static final Color LIGHT_BLUE = new Color(182, 217, 253);

6
designer_base/src/com/fr/design/gui/ibutton/UIButtonUI.java

@ -51,11 +51,11 @@ public class UIButtonUI extends BasicButtonUI {
protected void doExtraPainting(UIButton b, Graphics2D g2d, int w, int h, String selectedRoles) { protected void doExtraPainting(UIButton b, Graphics2D g2d, int w, int h, String selectedRoles) {
if (isPressed(b) && b.isPressedPainted()) { if (isPressed(b) && b.isPressedPainted()) {
GUIPaintUtils.fillPressed(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles)); GUIPaintUtils.fillPressed(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), UIConstants.COMBOBOX_BTN_PRESS);
} else if (isRollOver(b)) { } else if (isRollOver(b)) {
GUIPaintUtils.fillRollOver(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted()); GUIPaintUtils.fillRollOver(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted(), UIConstants.COMBOBOX_BTN_ROLLOVER);
} else if (b.isNormalPainted()) { } else if (b.isNormalPainted()) {
GUIPaintUtils.fillNormal(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted()); GUIPaintUtils.fillNormal(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted(), UIConstants.COMBOBOX_BTN_NORMAL);
} }
} }

14
designer_base/src/com/fr/design/utils/gui/GUIPaintUtils.java

@ -49,6 +49,7 @@ public class GUIPaintUtils {
/** /**
* 正常状态填充 * 正常状态填充
*
* @param g2d 图形对象 * @param g2d 图形对象
* @param x x坐标 * @param x x坐标
* @param y y坐标 * @param y y坐标
@ -60,12 +61,16 @@ public class GUIPaintUtils {
* @param isPressedPainted 是否按压画 * @param isPressedPainted 是否按压画
*/ */
public static final void fillNormal(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection, boolean isAuthorityEdited, boolean isPressedPainted) { public static final void fillNormal(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection, boolean isAuthorityEdited, boolean isPressedPainted) {
fillNormal(g2d, x, y, width, height, isRound, rectDirection, isAuthorityEdited, isPressedPainted, UIConstants.ATTRIBUTE_NORMAL);
}
public static final void fillNormal(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection, boolean isAuthorityEdited, boolean isPressedPainted, Color color) {
GradientPaint gp; GradientPaint gp;
if (BaseUtils.isAuthorityEditing() && isAuthorityEdited) { if (BaseUtils.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 - 1, UIConstants.AUTHORITY_DARK_BLUE);
} else if (isPressedPainted) { } else if (isPressedPainted) {
gp = new GradientPaint(1, 1, UIConstants.ATTRIBUTE_NORMAL, 1, height - 1, UIConstants.ATTRIBUTE_NORMAL); gp = new GradientPaint(1, 1, color, 1, height - 1, color);
}else{ } else {
gp = new GradientPaint(1, 1, UIConstants.SHADOW_GREY, 1, height - 1, UIConstants.SHADOW_GREY); gp = new GradientPaint(1, 1, UIConstants.SHADOW_GREY, 1, height - 1, UIConstants.SHADOW_GREY);
} }
@ -74,6 +79,7 @@ public class GUIPaintUtils {
/** /**
* 鼠标悬停状态填充 * 鼠标悬停状态填充
*
* @param g2d 图形对象 * @param g2d 图形对象
* @param x x坐标 * @param x x坐标
* @param y y坐标 * @param y y坐标
@ -104,6 +110,7 @@ public class GUIPaintUtils {
/** /**
* 按压状态填充 * 按压状态填充
*
* @param g2d 图形对象 * @param g2d 图形对象
* @param x x坐标 * @param x x坐标
* @param y y坐标 * @param y y坐标
@ -112,7 +119,6 @@ public class GUIPaintUtils {
* @param isRound 是否圆角 * @param isRound 是否圆角
* @param rectDirection 矩形方向 * @param rectDirection 矩形方向
* @param isAuthorityEdited 是否权限编辑 * @param isAuthorityEdited 是否权限编辑
*
*/ */
public static final void fillPressed(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection, boolean isAuthorityEdited) { public static final void fillPressed(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection, boolean isAuthorityEdited) {
fillPressed(g2d, x, y, width, height, isRound, rectDirection, isAuthorityEdited, null); fillPressed(g2d, x, y, width, height, isRound, rectDirection, isAuthorityEdited, null);
@ -147,8 +153,10 @@ public class GUIPaintUtils {
g2d.setColor(oldColor); g2d.setColor(oldColor);
} }
/** /**
* 自定义画笔填充 * 自定义画笔填充
*
* @param g2d 图形对象 * @param g2d 图形对象
* @param x x坐标 * @param x x坐标
* @param y y坐标 * @param y y坐标

Loading…
Cancel
Save