com.barrybecker4.ui.sliders.SliderGroup Maven / Gradle / Ivy
/** Copyright by Barry G. Becker, 2000-2011. Licensed under MIT License: http://www.opensource.org/licenses/MIT */
package com.barrybecker4.ui.sliders;
import com.barrybecker4.common.format.FormatUtil;
import javax.swing.*;
import javax.swing.border.EtchedBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
/**
* A group of horizontal sliders arranged vertically.
*
* @author Barry Becker
*/
public class SliderGroup extends JPanel implements ChangeListener {
private SliderGroupChangeListener sliderListener_;
private SliderProperties[] sliderProps_;
private JLabel[] labels_;
private JSlider[] sliders_;
private static final int DEFAULT_MIN = 0;
private static final int DEFAULT_MAX = 100;
private static final int DEFAULT_INITIAL = 50;
/** Protected constructor so derived class can do its own initialization. */
protected SliderGroup() {}
/**
* @param sliderNames used for both identification and labels
*/
public SliderGroup(String[] sliderNames) {
int numSliders = sliderNames.length;
SliderProperties[] sliderProps = new SliderProperties[numSliders];
for (int i=0; i