Browse Source

[#344] Fire change when opacity has changed

pull/349/head
SiboVG 1 year ago committed by Jannis Weis
parent
commit
1e65bacabc
  1. 3
      core/src/main/java/com/github/weisj/darklaf/ui/colorchooser/ColorTriangle.java
  2. 2
      core/src/main/java/com/github/weisj/darklaf/ui/colorchooser/ColorWheelPanel.java

3
core/src/main/java/com/github/weisj/darklaf/ui/colorchooser/ColorTriangle.java

@ -262,8 +262,9 @@ public class ColorTriangle extends JComponent {
return opacity; return opacity;
} }
public void setOpacity(final double opacity) { public void setOpacity(final Object source, final double opacity) {
this.opacity = opacity; this.opacity = opacity;
fireColorChanged(source);
} }
public int[] getValuesForModel(final DarkColorModel model) { public int[] getValuesForModel(final DarkColorModel model) {

2
core/src/main/java/com/github/weisj/darklaf/ui/colorchooser/ColorWheelPanel.java

@ -49,7 +49,7 @@ public class ColorWheelPanel extends JPanel {
opacitySlider.setToolTipText("Opacity"); opacitySlider.setToolTipText("Opacity");
opacitySlider.setUnits(opacityInPercent ? SlideComponent.Unit.PERCENT : SlideComponent.Unit.LEVEL); opacitySlider.setUnits(opacityInPercent ? SlideComponent.Unit.PERCENT : SlideComponent.Unit.LEVEL);
opacitySlider.addListener(integer -> { opacitySlider.addListener(integer -> {
colorWheel.setOpacity(integer / 255.0); colorWheel.setOpacity(opacitySlider, integer / 255.0);
ColorWheelPanel.this.repaint(); ColorWheelPanel.this.repaint();
}); });
add(opacitySlider, BorderLayout.SOUTH); add(opacitySlider, BorderLayout.SOUTH);

Loading…
Cancel
Save