Class SliderFactory

java.lang.Object
edu.cnu.mdi.graphics.SliderFactory

public final class SliderFactory extends Object
  • Method Details

    • createLabeledSlider

      public static JSlider createLabeledSlider(Container parent, int min, int max, int initial, int majorTick, int minorTick, Font font, boolean showValue)
      Creates a self-contained panel containing a slider and an optional value label. This avoids hardcoding sizes and preserves the parent's layout.
      Parameters:
      parent - The container to which the slider panel will be added.
      min - The minimum value of the slider.
      max - The maximum value of the slider.
      initial - The initial value of the slider.
      majorTick - The major tick spacing for the slider.
      minorTick - The minor tick spacing for the slider, or 0 for none.
      font - The font to use for the slider and label.
      Throws:
      NullPointerException - if parent is null
      IllegalArgumentException - if min >= max, if initial is outside [min, max], if majorTick <= 0, or if minorTick < 0
    • createLabeledSlider

      public static JSlider createLabeledSlider(Container parent, float min, float max, float initial, float majorTick, float minorTick, Font font, boolean showValue, int numDec)
      Creates a self-contained panel containing a slider and an optional value label. This avoids hardcoding sizes and preserves the parent's layout. This method is for float values.
      Parameters:
      parent - The container to which the slider panel will be added.
      min - The minimum value of the slider.
      max - The maximum value of the slider.
      initial - The initial value of the slider.
      majorTick - The major tick spacing for the slider.
      minorTick - The minor tick spacing for the slider, or 0 for none.
      font - The font to use for the slider and label.
      numDec - The number of decimal places to display.
      Throws:
      NullPointerException - if parent is null
      IllegalArgumentException - if any of min, max, initial, majorTick, or minorTick is not finite; if min >= max, initial is outside [min, max], majorTick <= 0, or minorTick < 0; if numDec is outside [0, 6]; or if numDec is high enough relative to the range that scaling to an integer-backed JSlider would collapse the range or tick spacing to zero