public GradientPanel (GradientColorValue value, String name, String description, boolean hideGradientEditor) { super(value, name, description); this.value = value; initializeComponents(); if (hideGradientEditor) { gradientEditor.setVisible(false); } gradientEditor.percentages.clear(); for (float percent : value.getTimeline()) gradientEditor.percentages.add(percent); gradientEditor.colors.clear(); float[] colors = value.getColors(); for (int i = 0; i < colors.length;) { float r = colors[i++]; float g = colors[i++]; float b = colors[i++]; gradientEditor.colors.add(new Color(r, g, b)); } if (gradientEditor.colors.isEmpty() || gradientEditor.percentages.isEmpty()) { gradientEditor.percentages.clear(); gradientEditor.percentages.add(0f); gradientEditor.percentages.add(1f); gradientEditor.colors.clear(); gradientEditor.colors.add(Color.white); } setColor(gradientEditor.colors.get(0)); }
public GradientPanel (GradientColorValue value, String name, String description, boolean hideGradientEditor) { super(value, name, description); this.value = value; initializeComponents(); if (hideGradientEditor) { gradientEditor.setVisible(false); } gradientEditor.percentages.clear(); for (float percent : value.getTimeline()) gradientEditor.percentages.add(percent); gradientEditor.colors.clear(); float[] colors = value.getColors(); for (int i = 0; i < colors.length;) { float r = colors[i++]; float g = colors[i++]; float b = colors[i++]; gradientEditor.colors.add(new Color(r, g, b)); } if (gradientEditor.colors.isEmpty() || gradientEditor.percentages.isEmpty()) { gradientEditor.percentages.clear(); gradientEditor.percentages.add(0f); gradientEditor.percentages.add(1f); gradientEditor.colors.clear(); gradientEditor.colors.add(Color.white); } setColor(gradientEditor.colors.get(0)); }
public GradientPanel (GradientColorValue value, String name, String description, boolean hideGradientEditor) { super(value, name, description); this.value = value; initializeComponents(); if (hideGradientEditor) { gradientEditor.setVisible(false); } gradientEditor.percentages.clear(); for (float percent : value.getTimeline()) gradientEditor.percentages.add(percent); gradientEditor.colors.clear(); float[] colors = value.getColors(); for (int i = 0; i < colors.length;) { float r = colors[i++]; float g = colors[i++]; float b = colors[i++]; gradientEditor.colors.add(new Color(r, g, b)); } if (gradientEditor.colors.isEmpty() || gradientEditor.percentages.isEmpty()) { gradientEditor.percentages.clear(); gradientEditor.percentages.add(0f); gradientEditor.percentages.add(1f); gradientEditor.colors.clear(); gradientEditor.colors.add(Color.white); } setColor(gradientEditor.colors.get(0)); }