private void validateAndUpdatePreview(JTextField src) { Color color; if (myHex.hasFocus()) { Color c = ColorUtil.fromHex(myHex.getText(), null); color = c != null ? ColorUtil.toAlpha(c, myColorWheelPanel.myColorWheel.myOpacity) : null; } else { color = gatherRGB(); } if (color != null) { if (myColorWheelPanel.myOpacityComponent != null) { color = ColorUtil.toAlpha(color, myColorWheelPanel.myOpacityComponent.getValue()); } updatePreview(color, src == myHex); } }
private void setHSBValue(float h, float s, float b, int opacity) { //noinspection UseJBColor Color rgb = new Color(Color.HSBtoRGB(h, s, b)); setColor(ColorUtil.toAlpha(rgb, opacity), this); }