Components in Java

xiaoxiao2021-03-06  40

Jslider components

Jslider allows users to select an integer value within a range. The JSlider class inherits the JComponent class to customize JSLIDER to display labels for maincasle, secondary shift lines, and tick. Jslider also supports Snap-to Tick, which is to move to the minimum of it when the cursor is placed between two scales.

Most Swing GUI components support ways to interact with users through mouse and keyboard. If Jslider gets focus (ie, in the user interface is the currently selected GUI component), the left arrow keys and the arrow keys reduce the JSLider's cursor, respectively or add a scale. The PGDN key and the PAUP key reduce the JSLider's cursors or increase the total scale range. The HOME button moves the cursor to the minimum of Jslider, and the End key moves the cursor to the maximum of JSlider.

1. True is a setinVerted method for the JSlider class for the parameter to exchange the location of the minimum and maximum values ​​in JSLIDER.

2, if a new GUI component has the minimum height and width (ie, the size of this still smaller size will not be valid), rewrite the getMinimumSize method, and minimize width and height as an instance of the Dimension class. return.

3. For most GUI components, the getMinimumSize method implements the result of returning the getPreferredSize method of the component.

Setmajortickspacing method indicates the unit of the JSLider's main scale. The parameters of the setPainTicks method indicate that the scale is displayed (not displayed by default).

转载请注明原文地址:https://www.9cbs.com/read-58449.html

New Post(0)