Class ResourcefulJSpinnerDateEditor

All Implemented Interfaces:
dev.javai18n.core.Localizable.LocaleEventListener, dev.javai18n.core.Resourceful, ImageObserver, LayoutManager, MenuContainer, PropertyChangeListener, Serializable, EventListener, Accessible, ChangeListener

public class ResourcefulJSpinnerDateEditor extends JSpinner.DateEditor implements dev.javai18n.core.Resourceful, dev.javai18n.core.Localizable.LocaleEventListener
A JSpinner.DateEditor that participates in locale change events, updating its accessible metadata, font, name, and tooltip whenever the application locale changes.

JSpinner.DateEditor formats the spinner's date value using a SimpleDateFormat. This class handles the accessible metadata; the format pattern itself must be reinstalled by the caller in response to locale changes (see ResourcefulJSpinner for the recommended approach).

See Also:
  • Constructor Details

    • ResourcefulJSpinnerDateEditor

      protected ResourcefulJSpinnerDateEditor(dev.javai18n.core.Resource resource, JSpinner spinner)
      Constructs a JSpinner.DateEditor bound to the given resource with the default date format.
      Parameters:
      resource - The resource identifying the locale source and bundle key.
      spinner - The JSpinner this editor is associated with.
    • ResourcefulJSpinnerDateEditor

      protected ResourcefulJSpinnerDateEditor(dev.javai18n.core.Resource resource, JSpinner spinner, String dateFormatPattern)
      Constructs a JSpinner.DateEditor bound to the given resource with the specified date format pattern.
      Parameters:
      resource - The resource identifying the locale source and bundle key.
      spinner - The JSpinner this editor is associated with.
      dateFormatPattern - A SimpleDateFormat pattern string.
  • Method Details

    • create

      public static ResourcefulJSpinnerDateEditor create(dev.javai18n.core.Resource resource, JSpinner spinner)
      Create a ResourcefulJSpinnerDateEditor with the default date format pattern.
      Parameters:
      resource - A Resource containing a JComponentPropertyBundle.
      spinner - The JSpinner this editor is associated with.
      Returns:
      A ResourcefulJSpinnerDateEditor registered to listen to LocaleEvents from the resource's source.
    • create

      public static ResourcefulJSpinnerDateEditor create(dev.javai18n.core.Resource resource, JSpinner spinner, String dateFormatPattern)
      Create a ResourcefulJSpinnerDateEditor with the specified date format pattern.
      Parameters:
      resource - A Resource containing a JComponentPropertyBundle.
      spinner - The JSpinner this editor is associated with.
      dateFormatPattern - A SimpleDateFormat pattern string.
      Returns:
      A ResourcefulJSpinnerDateEditor registered to listen to LocaleEvents from the resource's source.
    • initialize

      protected final void initialize()
      Registers this component as a locale-event listener on its resource source and applies the initial locale-specific values from the resource bundle.
    • updateLocaleSpecificValues

      protected void updateLocaleSpecificValues()
      Applies locale-specific values from the associated resource bundle to this component.
    • processLocaleEvent

      public void processLocaleEvent(dev.javai18n.core.Localizable.LocaleEvent event)
      Specified by:
      processLocaleEvent in interface dev.javai18n.core.Localizable.LocaleEventListener
    • getResource

      public dev.javai18n.core.Resource getResource()
      Specified by:
      getResource in interface dev.javai18n.core.Resourceful
    • setResource

      public void setResource(dev.javai18n.core.Resource resource)
      Specified by:
      setResource in interface dev.javai18n.core.Resourceful
    • dispose

      public void dispose()
      Unregister this component as a locale-event listener on its resource's source. Call this when the component is being permanently discarded so that it does not accumulate in the source's listener list.