javax.swing.JSpinner .
| Modifier and Type | Class and Description |
|---|---|
| private class | SynthSpinnerUI.
Listen to editor text field focus changes and repaint whole spinner |
| private static class | SynthSpinnerUI.
A simple layout manager for the editor and the next/previous buttons. |
| Modifier and Type | Field and Description |
|---|---|
| private SynthSpinnerUI. | editorFocusHandler
A FocusListener implementation which causes the entire spinner to be repainted whenever the editor component (typically a text field) becomes focused, or loses focus. |
| private SynthStyle |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected JComponent | Returns: the JSpinners editor JComponent, spinner.getEditor() by defaultOverrides javax. This method is called by installUI to get the editor component
of the |
| protected LayoutManager | createLayout()
Overrides javax. Creates a |
| protected Component | createNextButton()
Overrides javax. Creates an increment button, i.e. component that replaces the spinner
value with the object returned by |
| protected Component | createPreviousButton()
Overrides javax. Creates a decrement button, i.e. component that replaces the spinner
value with the object returned by |
| public static ComponentUI | Returns: a new SynthSpinnerUI objectthe JSpinner (not used) c)Hides javax. Returns a new instance of SynthSpinnerUI. |
| public SynthContext | getContext(JComponent c)
Implements javax. Returns the Context for the specified component. |
| private SynthContext | |
| protected void | installDefaults()
Overrides javax. Initializes the |
| protected void | installListeners()
Overrides javax. Initializes |
| public void | paint(Graphics
the g, JComponent Graphics object used for paintingthe component being painted c)Overrides javax. Paints the specified component according to the Look and Feel. |
| protected void | paint(SynthContext
context for the component being painted context, Graphics the g)Graphics object used for paintingPaints the specified component. |
| public void | paintBorder(SynthContext context, Graphics g, int x, int y, int w, int h)
Implements javax. Paints the border. |
| public void | propertyChange(PropertyChangeEvent e)
Implements java. This method gets called when a bound property is changed. |
| protected void | replaceEditor(JComponent oldEditor, JComponent newEditor)
Overrides javax. Called by the |
| protected void | uninstallDefaults()
Overrides javax. Sets the |
| protected void | uninstallListeners()
Overrides javax. Removes the |
| public void | update(Graphics
the g, JComponent Graphics object used for paintingthe component being painted c)Overrides javax. Notifies this UI delegate to repaint the specified component. |
| private void | |
| private void |
| editorFocusHandler | back to summary |
|---|---|
| private SynthSpinnerUI. A FocusListener implementation which causes the entire spinner to be repainted whenever the editor component (typically a text field) becomes focused, or loses focus. This is necessary because since SynthSpinnerUI is composed of an editor and two buttons, it is necessary that all three components indicate that they are "focused" so that they can be drawn appropriately. The repaint is used to ensure that the buttons are drawn in the new focused or unfocused state, mirroring that of the editor. | |
| style | back to summary |
|---|---|
| private SynthStyle style | |
| SynthSpinnerUI | back to summary |
|---|---|
| public SynthSpinnerUI() Constructs a | |
| createEditor | back to summary |
|---|---|
| protected JComponent createEditor() Overrides javax. This method is called by installUI to get the editor component
of the Typically this method would be overridden to wrap the editor with a container with a custom border, since one can't assume that the editors border can be set directly.
The
| |
| createLayout | back to summary |
|---|---|
| protected LayoutManager createLayout() Overrides javax. Doc from javax. Creates a
| |
| createNextButton | back to summary |
|---|---|
| protected Component createNextButton() Overrides javax. Doc from javax. Creates an increment button, i.e. component that replaces the spinner
value with the object returned by
| |
| createPreviousButton | back to summary |
|---|---|
| protected Component createPreviousButton() Overrides javax. Doc from javax. Creates a decrement button, i.e. component that replaces the spinner
value with the object returned by
| |
| createUI | back to summary |
|---|---|
| public static ComponentUI createUI(JComponent c) Hides javax. Returns a new instance of SynthSpinnerUI.
| |
| getContext | back to summary |
|---|---|
| public SynthContext getContext(JComponent c) Implements javax. Doc from javax. Returns the Context for the specified component.
| |
| getContext | back to summary |
|---|---|
| private SynthContext getContext(JComponent c, int state) | |
| installDefaults | back to summary |
|---|---|
| protected void installDefaults() Overrides javax. Initializes the
| |
| installListeners | back to summary |
|---|---|
| protected void installListeners() Overrides javax. Doc from javax. Initializes
This method is called by
| |
| paint | back to summary |
|---|---|
| public void paint(Graphics g, JComponent c) Overrides javax. Paints the specified component according to the Look and Feel. This method is not used by Synth Look and Feel.
Painting is handled by the
| |
| paint | back to summary |
|---|---|
| protected void paint(SynthContext context, Graphics g) Paints the specified component. This implementation does nothing.
| |
| paintBorder | back to summary |
|---|---|
| public void paintBorder(SynthContext context, Graphics g, int x, int y, int w, int h) Implements javax. Doc from javax. Paints the border.
| |
| propertyChange | back to summary |
|---|---|
| public void propertyChange(PropertyChangeEvent e) Implements java. Doc from java. This method gets called when a bound property is changed.
| |
| replaceEditor | back to summary |
|---|---|
| protected void replaceEditor(JComponent oldEditor, JComponent newEditor) Overrides javax. Called by the spinner.remove(oldEditor); spinner.add(newEditor, "Editor");The implementation of replaceEditor should be coordinated
with the createEditor method.
| |
| uninstallDefaults | back to summary |
|---|---|
| protected void uninstallDefaults() Overrides javax. Sets the
| |
| uninstallListeners | back to summary |
|---|---|
| protected void uninstallListeners() Overrides javax. Doc from javax. Removes the
This method is called by
| |
| update | back to summary |
|---|---|
| public void update(Graphics g, JComponent c) Overrides javax. Notifies this UI delegate to repaint the specified component.
This method paints the component background, then calls
the In general, this method does not need to be overridden by subclasses.
All Look and Feel rendering code should reside in the
| |
| updateEditorAlignment | back to summary |
|---|---|
| private void updateEditorAlignment(JComponent editor) Hides javax. | |
| updateStyle | back to summary |
|---|---|
| private void updateStyle(JSpinner c) | |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public void | focusGained(FocusEvent e)
Implements java. Invoked when a editor text field gains the keyboard focus. |
| public void | focusLost(FocusEvent e)
Implements java. Invoked when a editor text field loses the keyboard focus. |
| EditorFocusHandler | back to summary |
|---|---|
| private EditorFocusHandler() | |
| focusGained | back to summary |
|---|---|
| public void focusGained(FocusEvent e) Implements java. Invoked when a editor text field gains the keyboard focus.
| |
| focusLost | back to summary |
|---|---|
| public void focusLost(FocusEvent e) Implements java. Invoked when a editor text field loses the keyboard focus.
| |
| Modifier and Type | Field and Description |
|---|---|
| private Component | |
| private Component | |
| private Component |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public void | addLayoutComponent(String name, Component c)
Implements java. If the layout manager uses a per-component string,
adds the component |
| public void | layoutContainer(Container parent)
Implements java. Lays out the specified container. |
| public Dimension | minimumLayoutSize(Container parent)
Implements java. Calculates the minimum size dimensions for the specified container, given the components it contains. |
| public Dimension | preferredLayoutSize(Container parent)
Implements java. Calculates the preferred size dimensions for the specified container, given the components it contains. |
| private Dimension | |
| public void | removeLayoutComponent(Component c)
Implements java. Removes the specified component from the layout. |
| private void |
| editor | back to summary |
|---|---|
| private Component editor | |
| nextButton | back to summary |
|---|---|
| private Component nextButton | |
| previousButton | back to summary |
|---|---|
| private Component previousButton | |
| SpinnerLayout | back to summary |
|---|---|
| private SpinnerLayout() | |
| addLayoutComponent | back to summary |
|---|---|
| public void addLayoutComponent(String name, Component c) Implements java. Doc from java. If the layout manager uses a per-component string,
adds the component | |
| layoutContainer | back to summary |
|---|---|
| public void layoutContainer(Container parent) Implements java. Doc from java. Lays out the specified container. | |
| minimumLayoutSize | back to summary |
|---|---|
| public Dimension minimumLayoutSize(Container parent) Implements java. Doc from java. Calculates the minimum size dimensions for the specified container, given the components it contains. | |
| preferredLayoutSize | back to summary |
|---|---|
| public Dimension preferredLayoutSize(Container parent) Implements java. Doc from java. Calculates the preferred size dimensions for the specified container, given the components it contains. | |
| preferredSize | back to summary |
|---|---|
| private Dimension preferredSize(Component c) | |
| removeLayoutComponent | back to summary |
|---|---|
| public void removeLayoutComponent(Component c) Implements java. Doc from java. Removes the specified component from the layout. | |
| setBounds | back to summary |
|---|---|
| private void setBounds(Component c, int x, int y, int width, int height) | |