Constructor

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.
go to previous page   go to home page   go to next page

Answer:

A ChangeListener

Constructor

There are several constructors for sliders. Here is the one that is most useful:

JSlider( int orientation, int min, int max, int init )
  • orientation: JSlider.HORIZONTAL or JSlider.VERTICAL
  • min: the minimum value. The value when the slider is at the extreme left (or very bottom) of its range.
  • max: the maximum value. The value when the slider is at the extreme right (or very top) of its range.
  • init: the initial value of the slider

QUESTION 3:

Fill in the blanks to construct the slider:

slide = new JSlider(  ., , ,  );