This example demonstrates how to display labels (numerical values) at the major ticks (see e797 显示JSlider的标记). // Create a horizontal slider that moves left-to-right JSlider slider = new JSlider(); // Set major tick marks every 25 units int tickSpaci…
The slider supports two levels of tick marks, major and minor. Typically, the minor tick-mark spacing is smaller than the major tick-mark spacing. Also, the minor tick-mark spacing is a multiple of the major tick-mark spacing. However, the slider doe…
By default, the slider can take on any value from the minimum to the maximum. It is possible to configure the slider to allow only values at tick marks (see e797 显示JSlider的标记). This is done by calling JSlider.setSnapToTicks(true). The slider's minimu…