Class MaterialButtonUI
- java.lang.Object
-
- javax.swing.plaf.ComponentUI
-
- javax.swing.plaf.ButtonUI
-
- javax.swing.plaf.basic.BasicButtonUI
-
- mdlaf.components.button.MaterialButtonUI
-
- Direct Known Subclasses:
MaterialButtonsComponentsUI,MaterialInternalFrameTitlePane.ButtonTitlePane,MaterialTabbedPaneUI.ArrowButtonTabbedPane.ArrowButtonTabbedPaneUI
public class MaterialButtonUI extends javax.swing.plaf.basic.BasicButtonUI
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classMaterialButtonUI.MaterialListenerButtonEventThis class was implement receive the change propriety from button and change the default value inside this component, as, background, foreground.
-
Field Summary
Fields Modifier and Type Field Description protected intarchprotected java.awt.Colorbackgroundprotected java.awt.ColorborderColorprotected java.lang.BooleanborderEnabledprotected javax.swing.AbstractButtonbuttonprotected booleanbuttonBorderToAllprotected booleanbuttonToolBarInitprotected java.awt.ColorcolorMouseHoverDefaultButtonprotected java.awt.ColorcolorMouseHoverNormalButtonprotected java.awt.ColordefaultBackgroundprotected java.lang.BooleandefaultButtonprotected java.awt.ColordefaultForegroundprotected java.awt.ColordisabledBackgroundprotected java.awt.ColordisabledForegroundprotected java.beans.PropertyChangeListenerenableButtonprotected java.awt.Colorforegroundprotected MaterialMouseHovermouseHoverprotected java.lang.BooleanmouseHoverEnabledprotected booleanmouseHoverRunning
-
Constructor Summary
Constructors Constructor Description MaterialButtonUI()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected javax.swing.plaf.basic.BasicButtonListenercreateButtonListener(javax.swing.AbstractButton b)static javax.swing.plaf.ComponentUIcreateUI(javax.swing.JComponent c)protected voidinstallDefaults(javax.swing.AbstractButton b)The installDefaults method is a good place to add the default setting, because it is called before to install methods and this give to the user the possibility to change the button style inside the installation method without worried about the order pre and post super.install call.protected voidinstallListeners(javax.swing.AbstractButton b)voidinstallUI(javax.swing.JComponent c)Inside the installUI method are init only proprieties used inside this component the background or foreground ara managed to BasicButtonUI, @see BasicButtonUIjava.lang.BooleanisDefaultButton()protected booleanisToolBarButton(java.awt.Component component)voidpaint(java.awt.Graphics g, javax.swing.JComponent c)protected voidpaintBackground(java.awt.Graphics g, javax.swing.JComponent c)This method paint background, inside it will paint the border to buttons.protected voidpaintBorderButton(java.awt.Graphics graphics, javax.swing.JComponent b)protected voidpaintButtonPressed(java.awt.Graphics g, javax.swing.AbstractButton b)protected voidpaintFocus(java.awt.Graphics g, javax.swing.AbstractButton b, java.awt.Rectangle viewRect, java.awt.Rectangle textRect, java.awt.Rectangle iconRect)protected voidpaintFocusRing(java.awt.Graphics g, javax.swing.JButton b)protected voidpaintText(java.awt.Graphics g, javax.swing.JComponent c, java.awt.Rectangle textRect, java.lang.String text)voidsetColorMouseHoverDefaultButton(java.awt.Color colorMouseHoverDefaultButton)This method is used inside the TimerUI to set a new MouseHover color.voidsetColorMouseHoverNormalButton(java.awt.Color colorMouseHoverNormalButton)This method is used inside the TimerUI to set a new MouseHover color.protected voiduninstallListeners(javax.swing.AbstractButton b)voiduninstallUI(javax.swing.JComponent c)-
Methods inherited from class javax.swing.plaf.basic.BasicButtonUI
clearTextShiftOffset, getBaseline, getBaselineResizeBehavior, getDefaultTextIconGap, getMaximumSize, getMinimumSize, getPreferredSize, getPropertyPrefix, getTextShiftOffset, installKeyboardActions, paintIcon, paintText, setTextShiftOffset, uninstallDefaults, uninstallKeyboardActions
-
-
-
-
Field Detail
-
button
protected javax.swing.AbstractButton button
-
mouseHoverEnabled
protected java.lang.Boolean mouseHoverEnabled
-
foreground
protected java.awt.Color foreground
-
background
protected java.awt.Color background
-
disabledBackground
protected java.awt.Color disabledBackground
-
disabledForeground
protected java.awt.Color disabledForeground
-
defaultBackground
protected java.awt.Color defaultBackground
-
defaultForeground
protected java.awt.Color defaultForeground
-
colorMouseHoverDefaultButton
protected java.awt.Color colorMouseHoverDefaultButton
-
colorMouseHoverNormalButton
protected java.awt.Color colorMouseHoverNormalButton
-
borderColor
protected java.awt.Color borderColor
-
defaultButton
protected java.lang.Boolean defaultButton
-
borderEnabled
protected java.lang.Boolean borderEnabled
-
arch
protected int arch
-
enableButton
protected java.beans.PropertyChangeListener enableButton
-
buttonBorderToAll
protected boolean buttonBorderToAll
-
mouseHoverRunning
protected boolean mouseHoverRunning
-
buttonToolBarInit
protected boolean buttonToolBarInit
-
mouseHover
protected MaterialMouseHover mouseHover
-
-
Method Detail
-
createUI
public static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)
-
installUI
public void installUI(javax.swing.JComponent c)
Inside the installUI method are init only proprieties used inside this component the background or foreground ara managed to BasicButtonUI, @see BasicButtonUI- Overrides:
installUIin classjavax.swing.plaf.basic.BasicButtonUI
-
installDefaults
protected void installDefaults(javax.swing.AbstractButton b)
The installDefaults method is a good place to add the default setting, because it is called before to install methods and this give to the user the possibility to change the button style inside the installation method without worried about the order pre and post super.install call.FIXME: starting the transition to the workflow described in the comment
- Overrides:
installDefaultsin classjavax.swing.plaf.basic.BasicButtonUI
-
uninstallUI
public void uninstallUI(javax.swing.JComponent c)
- Overrides:
uninstallUIin classjavax.swing.plaf.basic.BasicButtonUI
-
paint
public void paint(java.awt.Graphics g, javax.swing.JComponent c)- Overrides:
paintin classjavax.swing.plaf.basic.BasicButtonUI
-
paintText
protected void paintText(java.awt.Graphics g, javax.swing.JComponent c, java.awt.Rectangle textRect, java.lang.String text)- Overrides:
paintTextin classjavax.swing.plaf.basic.BasicButtonUI
-
paintBackground
protected void paintBackground(java.awt.Graphics g, javax.swing.JComponent c)This method paint background, inside it will paint the border to buttons.param g Graphics Object, with this object is possible paint the component JButton param c Component Object, represent the button, if possible use this object or the propriety called button inside this class
-
paintFocus
protected void paintFocus(java.awt.Graphics g, javax.swing.AbstractButton b, java.awt.Rectangle viewRect, java.awt.Rectangle textRect, java.awt.Rectangle iconRect)- Overrides:
paintFocusin classjavax.swing.plaf.basic.BasicButtonUI
-
paintButtonPressed
protected void paintButtonPressed(java.awt.Graphics g, javax.swing.AbstractButton b)- Overrides:
paintButtonPressedin classjavax.swing.plaf.basic.BasicButtonUI
-
createButtonListener
protected javax.swing.plaf.basic.BasicButtonListener createButtonListener(javax.swing.AbstractButton b)
- Overrides:
createButtonListenerin classjavax.swing.plaf.basic.BasicButtonUI
-
installListeners
protected void installListeners(javax.swing.AbstractButton b)
- Overrides:
installListenersin classjavax.swing.plaf.basic.BasicButtonUI
-
uninstallListeners
protected void uninstallListeners(javax.swing.AbstractButton b)
- Overrides:
uninstallListenersin classjavax.swing.plaf.basic.BasicButtonUI
-
paintFocusRing
protected void paintFocusRing(java.awt.Graphics g, javax.swing.JButton b)
-
paintBorderButton
protected void paintBorderButton(java.awt.Graphics graphics, javax.swing.JComponent b)
-
setColorMouseHoverDefaultButton
public void setColorMouseHoverDefaultButton(java.awt.Color colorMouseHoverDefaultButton)
This method is used inside the TimerUI to set a new MouseHover color.For example: if you set a personal color on the mouseHove effect, you need to create a new mouseHover event on this component with a code as MaterialUIMovement.getMovement(COMPONENT, COLOR); The event creates to previous system call need to refresh the mouseHover color in this class to have the correct effect when the button is pressed
This should be remove e override the logic with a listener, but for the moment is implemented only this solution.
-
setColorMouseHoverNormalButton
public void setColorMouseHoverNormalButton(java.awt.Color colorMouseHoverNormalButton)
This method is used inside the TimerUI to set a new MouseHover color.For example: if you set a personal color on the mouseHove effect, you need to create a new mouseHover event on this component with a code as MaterialUIMovement.getMovement(COMPONENT, COLOR); The event creates to previous system call need to refresh the mouseHover color in this class to have the correct effect when the button is pressed
This should be remove e override the logic with a listener, but for the moment is implemented only this solution.
-
isDefaultButton
public java.lang.Boolean isDefaultButton()
-
isToolBarButton
protected boolean isToolBarButton(java.awt.Component component)
-
-