类 JTextFieldDateEditor

    • 字段详细资料

      • date

        protected Date date
      • datePattern

        protected String datePattern
      • maskPattern

        protected String maskPattern
      • placeholder

        protected char placeholder
      • darkGreen

        protected Color darkGreen
    • 构造器详细资料

      • JTextFieldDateEditor

        public JTextFieldDateEditor()
      • JTextFieldDateEditor

        public JTextFieldDateEditor​(String datePattern,
                                    String maskPattern,
                                    char placeholder)
      • JTextFieldDateEditor

        public JTextFieldDateEditor​(boolean showMask,
                                    String datePattern,
                                    String maskPattern,
                                    char placeholder)
    • 方法详细资料

      • setDate

        public void setDate​(Date date)
        从接口复制的说明: IDateEditor
        Sets the date. This should be implemented as a bound property, firing the "date" property.
        指定者:
        setDate 在接口中 IDateEditor
        参数:
        date - the date to set
      • setDate

        protected void setDate​(Date date,
                               boolean firePropertyChange)
        Sets the date.
        参数:
        date - the date
        firePropertyChange - true, if the date property should be fired.
      • setDateFormatString

        public void setDateFormatString​(String dateFormatString)
        从接口复制的说明: IDateEditor
        Sets the date format string, e.g. "MM/dd/yy". If the date format string is null or invalid, the date format string will be set to the MEDIUM Simple date format of the current locale.
        指定者:
        setDateFormatString 在接口中 IDateEditor
        参数:
        dateFormatString - the date format string
      • getUiComponent

        public JComponent getUiComponent()
        从接口复制的说明: IDateEditor
        Returns the UI component, e.g. the actual JTextField implementing the editor.
        指定者:
        getUiComponent 在接口中 IDateEditor
        返回:
        the UI component
      • caretUpdate

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

        public void setLocale​(Locale locale)
        从接口复制的说明: IDateEditor
        Sets the locale. Usually this should have impact on the current date format string.
        指定者:
        setLocale 在接口中 IDateEditor
        覆盖:
        setLocale 在类中 Component
        参数:
        locale - the locale to set
      • createMaskFromDatePattern

        public String createMaskFromDatePattern​(String datePattern)
        Creates a mask from a date pattern. This is a very simple (and incomplete) implementation thet works only with numbers. A date pattern of "MM/dd/yy" will result in the mask "##/##/##". Probably you want to override this method if it does not fit your needs.
        参数:
        datePattern - the date pattern
        返回:
        the mask
      • isMaskVisible

        public boolean isMaskVisible()
        Returns true, if the mask is visible.
        返回:
        true, if the mask is visible
      • setMaskVisible

        public void setMaskVisible​(boolean isMaskVisible)
        Sets the mask visible.
        参数:
        isMaskVisible - true, if the mask should be visible
      • getPreferredSize

        public Dimension getPreferredSize()
        Returns the preferred size. If a date pattern is set, it is the size the date pattern would take.
        覆盖:
        getPreferredSize 在类中 JTextField
      • setEnabled

        public void setEnabled​(boolean b)
        Enables and disabled the compoment. It also fixes the background bug 4991597 and sets the background explicitely to a TextField.inactiveBackground.
        指定者:
        setEnabled 在接口中 IDateEditor
        覆盖:
        setEnabled 在类中 JComponent
        参数:
        b - true, if the UI component should be enabled.
      • setMaxSelectableDate

        public void setMaxSelectableDate​(Date max)
        从接口复制的说明: IDateEditor
        Sets the maximum selectable date.
        指定者:
        setMaxSelectableDate 在接口中 IDateEditor
        参数:
        max - maximum selectable date
      • setMinSelectableDate

        public void setMinSelectableDate​(Date min)
        从接口复制的说明: IDateEditor
        Sets the minimum selectable date.
        指定者:
        setMinSelectableDate 在接口中 IDateEditor
        参数:
        min - minimum selectable date
      • setSelectableDateRange

        public void setSelectableDateRange​(Date min,
                                           Date max)
        从接口复制的说明: IDateEditor
        Sets a valid date range for selectable dates. If max is before min, the default range with no limitation is set.
        指定者:
        setSelectableDateRange 在接口中 IDateEditor
        参数:
        min - the minimum selectable date or null (then the minimum date should be set to 01\01\0001)
        max - the maximum selectable date or null (then the maximum date should be set to 01\01\9999)
      • main

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