- java.lang.Object
- 
- javax.swing.plaf.ComponentUI
- 
- javax.swing.plaf.ButtonUI
- 
- javax.swing.plaf.basic.BasicButtonUI
- 
- javax.swing.plaf.synth.SynthButtonUI
 
 
 
 
- 
- All Implemented Interfaces:
- PropertyChangeListener,- EventListener,- SynthConstants,- SynthUI
 - Direct Known Subclasses:
- SynthToggleButtonUI
 
 
 public class SynthButtonUI extends BasicButtonUI implements PropertyChangeListener, SynthUI Provides the Synth L&F UI delegate forJButton.- Since:
- 1.7
 
- 
- 
Field Summary- 
Fields inherited from class javax.swing.plaf.basic.BasicButtonUIdefaultTextIconGap, defaultTextShiftOffset
 - 
Fields inherited from interface javax.swing.plaf.synth.SynthConstantsDEFAULT, DISABLED, ENABLED, FOCUSED, MOUSE_OVER, PRESSED, SELECTED
 
- 
 - 
Constructor SummaryConstructors Constructor Description SynthButtonUI()
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ComponentUIcreateUI(JComponent c)Creates a new UI object for the given component.intgetBaseline(JComponent c, int width, int height)Returns the baseline.SynthContextgetContext(JComponent c)Returns the Context for the specified component.protected IcongetDefaultIcon(AbstractButton b)Returns the default icon.protected IcongetIcon(AbstractButton b)Returns the Icon to use for painting the button.DimensiongetMaximumSize(JComponent c)Returns the specified component's maximum size appropriate for the look and feel.DimensiongetMinimumSize(JComponent c)Returns the specified component's minimum size appropriate for the look and feel.DimensiongetPreferredSize(JComponent c)Returns the specified component's preferred size appropriate for the look and feel.protected IcongetSizingIcon(AbstractButton b)Returns the Icon used in calculating the preferred/minimum/maximum size.protected voidinstallDefaults(AbstractButton b)Installs default properties.protected voidinstallListeners(AbstractButton b)Registers listeners.voidpaint(Graphics g, JComponent c)Paints the specified component according to the Look and Feel.protected voidpaint(SynthContext context, Graphics g)Paints the specified component.voidpaintBorder(SynthContext context, Graphics g, int x, int y, int w, int h)Paints the border.voidpropertyChange(PropertyChangeEvent e)This method gets called when a bound property is changed.protected voiduninstallDefaults(AbstractButton b)Uninstalls default properties.protected voiduninstallListeners(AbstractButton b)Unregisters listeners.voidupdate(Graphics g, JComponent c)Notifies this UI delegate to repaint the specified component.- 
Methods inherited from class javax.swing.plaf.basic.BasicButtonUIclearTextShiftOffset, createButtonListener, getBaselineResizeBehavior, getDefaultTextIconGap, getPropertyPrefix, getTextShiftOffset, installKeyboardActions, installUI, paintButtonPressed, paintFocus, paintIcon, paintText, paintText, setTextShiftOffset, uninstallKeyboardActions, uninstallUI
 - 
Methods inherited from class javax.swing.plaf.ComponentUIcontains, getAccessibleChild, getAccessibleChildrenCount
 
- 
 
- 
- 
- 
Method Detail- 
createUIpublic static ComponentUI createUI(JComponent c) Creates a new UI object for the given component.- Parameters:
- c- component to create UI object for
- Returns:
- the UI object
 
 - 
installDefaultsprotected void installDefaults(AbstractButton b) Installs default properties.- Overrides:
- installDefaultsin class- BasicButtonUI
- Parameters:
- b- an abstract button
 
 - 
installListenersprotected void installListeners(AbstractButton b) Registers listeners.- Overrides:
- installListenersin class- BasicButtonUI
- Parameters:
- b- an abstract button
 
 - 
uninstallListenersprotected void uninstallListeners(AbstractButton b) Unregisters listeners.- Overrides:
- uninstallListenersin class- BasicButtonUI
- Parameters:
- b- an abstract button
 
 - 
uninstallDefaultsprotected void uninstallDefaults(AbstractButton b) Uninstalls default properties.- Overrides:
- uninstallDefaultsin class- BasicButtonUI
- Parameters:
- b- an abstract button
 
 - 
getContextpublic SynthContext getContext(JComponent c) Returns the Context for the specified component.- Specified by:
- getContextin interface- SynthUI
- Parameters:
- c- Component requesting SynthContext.
- Returns:
- SynthContext describing component.
 
 - 
getBaselinepublic int getBaseline(JComponent c, int width, int height) Returns the baseline.- Overrides:
- getBaselinein class- BasicButtonUI
- Parameters:
- c-- JComponentbaseline is being requested for
- width- the width to get the baseline for
- height- the height to get the baseline for
- Returns:
- baseline or a value < 0 indicating there is no reasonable baseline
- See Also:
- JComponent.getBaseline(int, int)
 
 - 
updatepublic void update(Graphics g, JComponent c) Notifies this UI delegate to repaint the specified component. This method paints the component background, then calls thepaint(SynthContext,Graphics)method.In general, this method does not need to be overridden by subclasses. All Look and Feel rendering code should reside in the paintmethod.- Overrides:
- updatein class- ComponentUI
- Parameters:
- g- the- Graphicsobject used for painting
- c- the component being painted
- See Also:
- paint(SynthContext,Graphics)
 
 - 
paintpublic void paint(Graphics g, JComponent c) 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(SynthContext,Graphics)method.- Overrides:
- paintin class- BasicButtonUI
- Parameters:
- g- the- Graphicsobject used for painting
- c- the component being painted
- See Also:
- paint(SynthContext,Graphics)
 
 - 
paintprotected void paint(SynthContext context, Graphics g) Paints the specified component.- Parameters:
- context- context for the component being painted
- g- the- Graphicsobject used for painting
- See Also:
- update(Graphics,JComponent)
 
 - 
paintBorderpublic void paintBorder(SynthContext context, Graphics g, int x, int y, int w, int h) Paints the border.- Specified by:
- paintBorderin interface- SynthUI
- Parameters:
- context- a component context
- g-- Graphicsto paint on
- x- the X coordinate
- y- the Y coordinate
- w- width of the border
- h- height of the border
 
 - 
getDefaultIconprotected Icon getDefaultIcon(AbstractButton b) Returns the default icon. This should not callback to the JComponent.- Parameters:
- b- button the icon is associated with
- Returns:
- default icon
 
 - 
getIconprotected Icon getIcon(AbstractButton b) Returns the Icon to use for painting the button. The icon is chosen with respect to the current state of the button.- Parameters:
- b- button the icon is associated with
- Returns:
- an icon
 
 - 
getMinimumSizepublic Dimension getMinimumSize(JComponent c) Returns the specified component's minimum size appropriate for the look and feel. Ifnullis returned, the minimum size will be calculated by the component's layout manager instead (this is the preferred approach for any component with a specific layout manager installed). The default implementation of this method invokesgetPreferredSizeand returns that value.- Overrides:
- getMinimumSizein class- BasicButtonUI
- Parameters:
- c- the component whose minimum size is being queried; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components
- Returns:
- a Dimensionobject ornull
- See Also:
- JComponent.getMinimumSize(),- LayoutManager.minimumLayoutSize(java.awt.Container),- ComponentUI.getPreferredSize(javax.swing.JComponent)
 
 - 
getPreferredSizepublic Dimension getPreferredSize(JComponent c) Returns the specified component's preferred size appropriate for the look and feel. Ifnullis returned, the preferred size will be calculated by the component's layout manager instead (this is the preferred approach for any component with a specific layout manager installed). The default implementation of this method returnsnull.- Overrides:
- getPreferredSizein class- BasicButtonUI
- Parameters:
- c- the component whose preferred size is being queried; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components
- Returns:
- a Dimensionobject containing given component's preferred size appropriate for the look and feel
- See Also:
- JComponent.getPreferredSize(),- LayoutManager.preferredLayoutSize(java.awt.Container)
 
 - 
getMaximumSizepublic Dimension getMaximumSize(JComponent c) Returns the specified component's maximum size appropriate for the look and feel. Ifnullis returned, the maximum size will be calculated by the component's layout manager instead (this is the preferred approach for any component with a specific layout manager installed). The default implementation of this method invokesgetPreferredSizeand returns that value.- Overrides:
- getMaximumSizein class- BasicButtonUI
- Parameters:
- c- the component whose maximum size is being queried; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components
- Returns:
- a Dimensionobject ornull
- See Also:
- JComponent.getMaximumSize(),- LayoutManager2.maximumLayoutSize(java.awt.Container)
 
 - 
getSizingIconprotected Icon getSizingIcon(AbstractButton b) Returns the Icon used in calculating the preferred/minimum/maximum size.- Parameters:
- b- specifies the- AbstractButtonused when calculating the preferred/minimum/maximum size.
- Returns:
- the Icon used in calculating the preferred/minimum/maximum size.
 
 - 
propertyChangepublic void propertyChange(PropertyChangeEvent e) This method gets called when a bound property is changed.- Specified by:
- propertyChangein interface- PropertyChangeListener
- Parameters:
- e- A PropertyChangeEvent object describing the event source and the property that has changed.
 
 
- 
 
-