Class AlphaSlider

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ChangeListener

public class AlphaSlider extends JPanel implements ChangeListener
A small labeled slider producing a 0-255 alpha value, meant for a "how opaque should translucent geometry be" control on a Panel3D-based view.

This widget only handles the UI: reading its current value (getAlpha()) and deciding what that value actually controls -- which items, and how -- is left entirely to the caller. In particular, this widget does not itself touch any Item3D's FILLALPHA property; an item not participating in Panel3D's opaque/transparent pass split (see Item3D#setFillAlpha(int)) will not actually blend just because this slider moved. The optional IntConsumer callback given to the full constructor is the hook for a caller that needs to do that bookkeeping (e.g. propagating the new value to a known set of items) before the resulting Panel3D.refresh() repaints.

See Also:
  • Constructor Details

    • AlphaSlider

      public AlphaSlider(Panel3D panel3D, String prompt)
      A slider with no extra onChange side effect beyond Panel3D.refresh().
    • AlphaSlider

      public AlphaSlider(Panel3D panel3D, String prompt, IntConsumer onChange)
      Parameters:
      panel3D - the panel to refresh whenever the slider moves
      prompt - label text shown to the left of the slider
      onChange - called with the new 0-255 value before panel3D.refresh(), or null for none
  • Method Details