类 JSpinField

    • 字段详细资料

      • textField

        protected JTextField textField
        the text (number) field
      • min

        protected int min
      • max

        protected int max
      • value

        protected int value
      • darkGreen

        protected Color darkGreen
    • 构造器详细资料

      • JSpinField

        public JSpinField()
        Default JSpinField constructor. The valid value range is between Integer.MIN_VALUE and Integer.MAX_VALUE. The initial value is 0.
      • JSpinField

        public JSpinField​(int min,
                          int max)
        JSpinField constructor with given minimum and maximum vaues and initial value 0.
    • 方法详细资料

      • adjustWidthToMaximumValue

        public void adjustWidthToMaximumValue()
      • setValue

        protected void setValue​(int newValue,
                                boolean updateTextField,
                                boolean firePropertyChange)
        Sets the value attribute of the JSpinField object.
        参数:
        newValue - The new value
        updateTextField - true if text field should be updated
      • setValue

        public void setValue​(int newValue)
        Sets the value. This is a bound property.
        参数:
        newValue - the new value
        另请参阅:
        getValue()
      • getValue

        public int getValue()
        Returns the value.
        返回:
        the value value
      • setMinimum

        public void setMinimum​(int newMinimum)
        Sets the minimum value.
        参数:
        newMinimum - the new minimum value
        另请参阅:
        getMinimum()
      • getMinimum

        public int getMinimum()
        Returns the minimum value.
        返回:
        the minimum value
      • setMaximum

        public void setMaximum​(int newMaximum)
        Sets the maximum value and adjusts the preferred width.
        参数:
        newMaximum - the new maximum value
        另请参阅:
        getMaximum()
      • setHorizontalAlignment

        public void setHorizontalAlignment​(int alignment)
        Sets the horizontal alignment of the displayed value.
        参数:
        alignment - the horizontal alignment
      • getMaximum

        public int getMaximum()
        Returns the maximum value.
        返回:
        the maximum value
      • setFont

        public void setFont​(Font font)
        Sets the font property.
        覆盖:
        setFont 在类中 JComponent
        参数:
        font - the new font
      • setForeground

        public void setForeground​(Color fg)
        Sets the foreground
        覆盖:
        setForeground 在类中 JComponent
        参数:
        fg - the foreground
      • caretUpdate

        public void caretUpdate​(CaretEvent e)
        After any user input, the value of the textfield is proofed. Depending on being an integer, the value is colored green or red.
        指定者:
        caretUpdate 在接口中 CaretListener
        参数:
        e - the caret event
      • actionPerformed

        public void actionPerformed​(ActionEvent e)
        After any user input, the value of the textfield is proofed. Depending on being an integer, the value is colored green or red. If the textfield is green, the enter key is accepted and the new value is set.
        指定者:
        actionPerformed 在接口中 ActionListener
        参数:
        e - Description of the Parameter
      • setEnabled

        public void setEnabled​(boolean enabled)
        Enable or disable the JSpinField.
        覆盖:
        setEnabled 在类中 JComponent
        参数:
        enabled - The new enabled value
      • getSpinner

        public Component getSpinner()
        Returns the year chooser's spinner (which allow the focus to be set to it).
        返回:
        Component the spinner or null, if the month chooser has no spinner
      • main

        public static void main​(String[] s)
        Creates a JFrame with a JSpinField inside and can be used for testing.
        参数:
        s - The command line arguments
      • focusLost

        public void focusLost​(FocusEvent e)
        The value of the text field is checked against a valid (green) value. If valid, the value is set and a property change is fired.
        指定者:
        focusLost 在接口中 FocusListener