From 26d4995b54c6253b2b012ec19e6b78d5f763e800 Mon Sep 17 00:00:00 2001 From: Albert Cardona Date: Fri, 17 Apr 2009 09:58:43 +0200 Subject: [PATCH] Disable/enable layer alpha sliders when entering/exiting color mode. --- ini/trakem2/display/Display.java | 4 ++++ ini/trakem2/display/LayerPanel.java | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ini/trakem2/display/Display.java b/ini/trakem2/display/Display.java index 62a40cd0..8cd58fa7 100644 --- a/ini/trakem2/display/Display.java +++ b/ini/trakem2/display/Display.java @@ -4002,6 +4002,7 @@ public final class Display extends DBObject implements ActionListener, ImageList final LayerPanel lp = layer_panels.get(l); lp.setColor(Color.white); setColorChannel(lp.layer, Color.white); + lp.slider.setEnabled(true); } layer_channels.clear(); } @@ -4078,6 +4079,9 @@ public final class Display extends DBObject implements ActionListener, ImageList } else { Utils.log2("Trying to set unacceptable color for layer " + layer + " : " + color); } + // enable/disable sliders + final boolean b = 0 == layer_channels.size(); + for (final LayerPanel lp : layer_panels.values()) lp.slider.setEnabled(b); } this.canvas.repaint(true); } diff --git a/ini/trakem2/display/LayerPanel.java b/ini/trakem2/display/LayerPanel.java index f8498c3d..6cf340f5 100644 --- a/ini/trakem2/display/LayerPanel.java +++ b/ini/trakem2/display/LayerPanel.java @@ -48,7 +48,7 @@ import java.awt.Dimension; public final class LayerPanel extends JPanel implements MouseListener { private final JLabel title; - private final JSlider slider = new JSlider(javax.swing.SwingConstants.HORIZONTAL, 0, 100, 0); + protected final JSlider slider = new JSlider(javax.swing.SwingConstants.HORIZONTAL, 0, 100, 0); private Color color = Color.white; private float alpha = 0.0f; // for overlays -- 2.11.4.GIT