|
|
@ -84,15 +84,22 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { |
|
|
|
initMenuColorPane(menuColorPane1); |
|
|
|
initMenuColorPane(menuColorPane1); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JPanel standardColorPane = new JPanel(new BorderLayout(0, 5)); |
|
|
|
|
|
|
|
standardColorPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); |
|
|
|
|
|
|
|
standardColorPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Standard_Color")), BorderLayout.CENTER); |
|
|
|
|
|
|
|
centerPane.add(standardColorPane); |
|
|
|
|
|
|
|
JPanel colorSelectPane = createStandardColorPane(); |
|
|
|
|
|
|
|
standardColorPane.add(colorSelectPane, BorderLayout.SOUTH); |
|
|
|
|
|
|
|
|
|
|
|
// 增加最近使用 pane
|
|
|
|
// 增加最近使用 pane
|
|
|
|
JPanel row1Pane = new JPanel(new BorderLayout(0, 5)); |
|
|
|
JPanel row1Pane = new JPanel(new BorderLayout(0, 5)); |
|
|
|
row1Pane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); |
|
|
|
row1Pane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); |
|
|
|
row1Pane.add(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Used")), BorderLayout.NORTH); |
|
|
|
row1Pane.add(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Used")), BorderLayout.CENTER); |
|
|
|
centerPane.add(row1Pane); |
|
|
|
centerPane.add(row1Pane); |
|
|
|
// 最近使用
|
|
|
|
// 最近使用
|
|
|
|
usedColorPane = new NewUsedColorPane(8, this, selectRealTime()); |
|
|
|
usedColorPane = new NewUsedColorPane(8, this, selectRealTime()); |
|
|
|
usedColorPane.setPreferredSize(new Dimension(168, 16)); |
|
|
|
usedColorPane.setPreferredSize(new Dimension(168, 16)); |
|
|
|
row1Pane.add(usedColorPane.getPane(), BorderLayout.CENTER); |
|
|
|
row1Pane.add(usedColorPane.getPane(), BorderLayout.SOUTH); |
|
|
|
|
|
|
|
|
|
|
|
// mod by anchore 16/11/16
|
|
|
|
// mod by anchore 16/11/16
|
|
|
|
final UIButton customButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_More_Color")); |
|
|
|
final UIButton customButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_More_Color")); |
|
|
@ -116,23 +123,48 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { |
|
|
|
centerPane.add(centerPane1); |
|
|
|
centerPane.add(centerPane1); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private JPanel createStandardColorPane(){ |
|
|
|
|
|
|
|
JPanel jPanel = new JPanel(new GridLayout(1, 10, 3, 0)); |
|
|
|
|
|
|
|
Color[] colorArray = ColorFactory.STANDARD_COLORS; |
|
|
|
|
|
|
|
for (int i = 0; i < colorArray.length; i++) { |
|
|
|
|
|
|
|
jPanel.add(new ColorCell(colorArray[i], this)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return jPanel; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void initThemeColorPane(JPanel menuColorPane){ |
|
|
|
private void initThemeColorPane(JPanel menuColorPane){ |
|
|
|
menuColorPane.setLayout(new GridLayout(1, 8, 3, 0)); |
|
|
|
menuColorPane.setLayout(new BorderLayout(0, 10)); |
|
|
|
|
|
|
|
JPanel northPane = new JPanel(new GridLayout(1, 8, 3, 0)); |
|
|
|
|
|
|
|
JPanel centerPane = new JPanel(new GridLayout(1, 8, 3, 0)); |
|
|
|
|
|
|
|
menuColorPane.add(northPane, BorderLayout.NORTH); |
|
|
|
|
|
|
|
menuColorPane.add(centerPane, BorderLayout.CENTER); |
|
|
|
//todo 暂时先写死,后续对接的时候从主体里面拿主题配色
|
|
|
|
//todo 暂时先写死,后续对接的时候从主体里面拿主题配色
|
|
|
|
Color[] colorArray = new Color[]{Color.decode("#FFFFFF"), Color.decode("#CCCCCC"), |
|
|
|
Color[] colorArray = new Color[]{Color.decode("#FFFFFF"), Color.decode("#CCCCCC"), |
|
|
|
Color.decode("#E6A48A"), Color.decode("#E68A8A"), Color.gray, Color.green, Color.DARK_GRAY, Color.CYAN, Color.YELLOW, Color.lightGray}; |
|
|
|
Color.decode("#E6A48A"), Color.decode("#E68A8A"), Color.gray, Color.green, Color.DARK_GRAY, Color.CYAN, Color.YELLOW, Color.lightGray}; |
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < colorArray.length; i++) { |
|
|
|
for (int i = 0; i < colorArray.length; i++) { |
|
|
|
Color color = colorArray[i]; |
|
|
|
Color color = colorArray[i]; |
|
|
|
boolean isDefaultColor = (i == 0 || i ==1); |
|
|
|
boolean isDefaultColor = (i == 0 || i == 1); |
|
|
|
JPanel jPanel = new JPanel(new GridLayout(5, 1, 0, 3)); |
|
|
|
northPane.add(createFineColorCell(color, isDefaultColor, i, 0)); |
|
|
|
jPanel.add(new FineColorCell(color, this, i, 0)); |
|
|
|
|
|
|
|
jPanel.add(new FineColorCell(color = saturationDown(color, isDefaultColor), this, i, 1)); |
|
|
|
|
|
|
|
jPanel.add(new FineColorCell(color = saturationDown(color, isDefaultColor), this, i, 2)); |
|
|
|
|
|
|
|
jPanel.add(new FineColorCell(color = saturationDown(color, isDefaultColor), this, i, 3)); |
|
|
|
|
|
|
|
jPanel.add(new FineColorCell(saturationDown(color, isDefaultColor), this, i, 4)); |
|
|
|
|
|
|
|
menuColorPane.add(jPanel); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < colorArray.length; i++) { |
|
|
|
|
|
|
|
Color color = colorArray[i]; |
|
|
|
|
|
|
|
boolean isDefaultColor = (i == 0 || i == 1); |
|
|
|
|
|
|
|
JPanel jPanel = new JPanel(new GridLayout(4, 1, 0, 3)); |
|
|
|
|
|
|
|
jPanel.add(createFineColorCell(color = saturationDown(color, isDefaultColor, true), isDefaultColor, i, 1)); |
|
|
|
|
|
|
|
jPanel.add(createFineColorCell(saturationDown(color, isDefaultColor, true), isDefaultColor, i, 2)); |
|
|
|
|
|
|
|
color = colorArray[i]; |
|
|
|
|
|
|
|
jPanel.add(createFineColorCell(color = saturationDown(color, isDefaultColor, false), isDefaultColor, i, 3)); |
|
|
|
|
|
|
|
jPanel.add(createFineColorCell(saturationDown(color, isDefaultColor, false), isDefaultColor, i, 4)); |
|
|
|
|
|
|
|
centerPane.add(jPanel); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private FineColorCell createFineColorCell(Color color, boolean isDefaultColor, int x, int y) { |
|
|
|
|
|
|
|
return isDefaultColor ? new FineColorCell(color, this) : new FineColorCell(color, this, x - 2, y); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -141,18 +173,18 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { |
|
|
|
* @param isDefaultColor |
|
|
|
* @param isDefaultColor |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static Color saturationDown(Color color, boolean isDefaultColor) { |
|
|
|
public static Color saturationDown(Color color, boolean isDefaultColor, boolean isLight) { |
|
|
|
float[] hsb = Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), new float[3]); |
|
|
|
float[] hsb = Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), new float[3]); |
|
|
|
if (!isDefaultColor) { |
|
|
|
if (!isDefaultColor) { |
|
|
|
hsb[1] += PURITY_VALUE; |
|
|
|
hsb[1] = isLight ? Math.max(0, hsb[1] - PURITY_VALUE) : Math.min(1, hsb[1] + PURITY_VALUE); |
|
|
|
} |
|
|
|
} |
|
|
|
hsb[2] -= BRIGHTNESS_VALUE; |
|
|
|
hsb[2] = isLight ? Math.min(1, hsb[2] + BRIGHTNESS_VALUE) : Math.max(0, hsb[2] - BRIGHTNESS_VALUE); |
|
|
|
return Color.getHSBColor(hsb[0], hsb[1], hsb[2]); |
|
|
|
Color color1 = Color.getHSBColor(hsb[0], hsb[1], hsb[2]); |
|
|
|
|
|
|
|
return color1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void initMenuColorPane(JPanel menuColorPane){ |
|
|
|
private void initMenuColorPane(JPanel menuColorPane) { |
|
|
|
menuColorPane.setLayout(new GridLayout(5, 8, 1, 1)); |
|
|
|
menuColorPane.setLayout(new GridLayout(5, 8, 3, 3)); |
|
|
|
menuColorPane.setBorder(BorderFactory.createEmptyBorder(8, 8, 0, 8)); |
|
|
|
|
|
|
|
Color[] colorArray = this.getColorArray(); |
|
|
|
Color[] colorArray = this.getColorArray(); |
|
|
|
for (int i = 0; i < colorArray.length; i++) { |
|
|
|
for (int i = 0; i < colorArray.length; i++) { |
|
|
|
Color color = colorArray[i] == null ? UsedColorPane.DEFAULT_COLOR : colorArray[i]; |
|
|
|
Color color = colorArray[i] == null ? UsedColorPane.DEFAULT_COLOR : colorArray[i]; |
|
|
@ -280,9 +312,9 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public Dimension getPreferredSize() { |
|
|
|
public Dimension getPreferredSize() { |
|
|
|
if (isSupportTransparent) { |
|
|
|
if (isSupportTransparent) { |
|
|
|
return new Dimension(197, 207); |
|
|
|
return new Dimension(197, 265); |
|
|
|
} |
|
|
|
} |
|
|
|
return new Dimension(197, 192); |
|
|
|
return new Dimension(197, 250); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|