Class NumberTextField

    • Constructor Detail

      • NumberTextField

        public NumberTextField​(NumberTextField.Type type)
        Constructs a new TextField. A default model is created, the initial string is null, and the number of columns is set to 0.
        Parameters:
        type - the type of numbers to check for
      • NumberTextField

        public NumberTextField​(NumberTextField.Type type,
                               String text)
        Constructs a new TextField initialized with the specified text. A default model is created and the number of columns is 0.
        Parameters:
        type - the type of numbers to check for
        text - the text to be displayed, or null
      • NumberTextField

        public NumberTextField​(NumberTextField.Type type,
                               int columns)
        Constructs a new empty TextField with the specified number of columns. A default model is created and the initial string is set to null.
        Parameters:
        type - the type of numbers to check for
        columns - the number of columns to use to calculate the preferred width; if columns is set to zero, the preferred width will be whatever naturally results from the component implementation
      • NumberTextField

        public NumberTextField​(NumberTextField.Type type,
                               String text,
                               int columns)
        Constructs a new TextField initialized with the specified text and columns. A default model is created.
        Parameters:
        type - the type of numbers to check for
        text - the text to be displayed, or null
        columns - the number of columns to use to calculate the preferred width; if columns is set to zero, the preferred width will be whatever naturally results from the component implementation
      • NumberTextField

        public NumberTextField​(NumberTextField.Type type,
                               Document doc,
                               String text,
                               int columns)
        Constructs a new BaseTextField that uses the given text storage model and the given number of columns. This is the constructor through which the other constructors feed. If the document is null, a default model is created.
        Parameters:
        type - the type of numbers to check for
        doc - the text storage to use; if this is null, a default will be provided by calling the createDefaultModel method
        text - the initial string to display, or null
        columns - the number of columns to use to calculate the preferred width >= 0; if columns is set to zero, the preferred width will be whatever naturally results from the component implementation
    • Method Detail

      • setValue

        public void setValue​(Number value)
        Sets the current value.
        Parameters:
        value - the value to use
      • getValue

        public Number getValue()
        Returns the current value.
        Returns:
        the current value, Double.NaN if empty
      • getValue

        public Number getValue​(Number defValue)
        Returns the current value.
        Parameters:
        defValue - the default value to return in case the text is empty
        Returns:
        the current value