public void setDefaultColor(float alpha, geogebra.common.awt.GColor gc) { defaultColor = gc; if (gc != null) this.setIcon( GeoGebraIcon.createColorSwatchIcon( alpha, iconSize, geogebra.awt.GColorD.getAwtColor(gc), null)); else this.setIcon(GeoGebraIcon.createNullSymbolIcon(iconSize.width, iconSize.height)); }
@Override public ImageIcon getButtonIcon() { ImageIcon icon = super.getButtonIcon(); if (icon == null && this.hasSlider) { icon = GeoGebraIcon.createColorSwatchIcon( getSliderValue() / 100f, iconSize, geogebra.awt.GColorD.getAwtColor(defaultColor), null); } return icon; }
private static ImageIcon[] getColorSwatchIcons( geogebra.common.awt.GColor[] colorArray, float alpha, Dimension iconSize, int colorSetType) { ImageIcon[] a = new ImageIcon[colorArray.length]; for (int i = 0; i < colorArray.length; i++) if (colorArray[i] != null) { a[i] = GeoGebraIcon.createColorSwatchIcon( alpha, iconSize, geogebra.awt.GColorD.getAwtColor(colorArray[i]), null); } else { a[i] = GeoGebraIcon.createNullSymbolIcon(iconSize.width, iconSize.height); } return a; }