| |
14. 31. 2. 使用BoundedRangeModel |
|
The interface contains four interrelated properties that are necessary to describe a range of values:
minimum, maximum, value, and extent. |
The settings for the four properties must abide by the following ordering: |
minimum <= value <= value+extent <= maximum
|
|
import java.awt.BorderLayout;
import javax.swing.JFrame;
import javax.swing.JSlider;
public class BoundedRangeModelInJSlider {
public static void main(String args[]) {
JFrame frame = new JFrame("Tick Slider");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JSlider oneJSlider = new JSlider();
System.out.println(oneJSlider.getModel().getMaximum());
frame.add(oneJSlider, BorderLayout.NORTH);
frame.setSize(300, 200);
frame.setVisible(true);
}
}
|
|
14. 31. 边界模型 | | 14. 31. 1. | 界范围模型JSlider | | | | 14. 31. 2. | 使用BoundedRangeModel | | |
|