CHAPTER 64 — Sliders and Change Events

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 home page   go to next page

created: 01/20/02; revised: 07/19/06; refurbished: 11/10/08

CHAPTER 64 — Sliders and Change Events

This chapter discusses class JSlider. A slider is a component that mimics the operation of an adjustment slide such as sometimes found on audio equipment.

vertical slider

Chapter Topics:

  • sliders
  • Major and minor ticks
  • The setPreferredSize() method
  • The setName() method
  • The getName() method
  • change events
  • The getSource() method

There are dozens of GUI components and features in Swing. Only a few of them are covered in these chapters. All components are described in the documentation available for downloading from a current JDK distribution. Many of them are featured in Sun's on-line tutorials.

QUESTION 1:

(Review:) What method adds a slider to a panel?