Class RectangleCloseButton
- java.lang.Object
-
- ch.swingfx.twinkle.style.closebutton.RectangleCloseButton
-
- All Implemented Interfaces:
ICloseButton
public class RectangleCloseButton extends java.lang.Object implements ICloseButton
A simple rectangle close button.
-
-
Field Summary
Fields Modifier and Type Field Description static intBOTTOM_RIGHTprivate static intDEFAULT_Xprivate static intDEFAULT_Yprivate java.awt.ColorfButtonBackgroundColorprivate java.awt.ColorfButtonBorderColorprivate java.awt.RectanglefButtonShapeprivate java.awt.BasicStrokefStrokeprivate intfXprivate intfYprivate static intSIZEstatic intSTROKE_WIDTHstatic intTOP_LEFT
-
Constructor Summary
Constructors Constructor Description RectangleCloseButton(java.awt.Color buttonBackgroundColor, java.awt.Color buttonBorderColor)RectangleCloseButton(java.awt.Color buttonBackgroundColor, java.awt.Color buttonBorderColor, int x, int y)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisMouseOverCloseButton(java.awt.Point mousePosition)Test if the mouse is over the close buttonvoidpaintCloseButton(java.awt.Graphics g)Paint the close buttonICloseButtonwithPosition(int x, int y)Set the position of the close button
-
-
-
Field Detail
-
DEFAULT_Y
private static final int DEFAULT_Y
- See Also:
- Constant Field Values
-
DEFAULT_X
private static final int DEFAULT_X
- See Also:
- Constant Field Values
-
SIZE
private static final int SIZE
- See Also:
- Constant Field Values
-
TOP_LEFT
public static final int TOP_LEFT
- See Also:
- Constant Field Values
-
BOTTOM_RIGHT
public static final int BOTTOM_RIGHT
- See Also:
- Constant Field Values
-
STROKE_WIDTH
public static final int STROKE_WIDTH
- See Also:
- Constant Field Values
-
fButtonShape
private java.awt.Rectangle fButtonShape
-
fX
private int fX
-
fY
private int fY
-
fStroke
private final java.awt.BasicStroke fStroke
-
fButtonBorderColor
private final java.awt.Color fButtonBorderColor
-
fButtonBackgroundColor
private final java.awt.Color fButtonBackgroundColor
-
-
Method Detail
-
paintCloseButton
public void paintCloseButton(java.awt.Graphics g)
Description copied from interface:ICloseButtonPaint the close button- Specified by:
paintCloseButtonin interfaceICloseButton- Parameters:
g-Graphicsto paint on
-
isMouseOverCloseButton
public boolean isMouseOverCloseButton(java.awt.Point mousePosition)
Description copied from interface:ICloseButtonTest if the mouse is over the close button- Specified by:
isMouseOverCloseButtonin interfaceICloseButton- Parameters:
mousePosition- position of the mouse- Returns:
- true if mouse if over the button
-
withPosition
public ICloseButton withPosition(int x, int y)
Description copied from interface:ICloseButtonSet the position of the close button- Specified by:
withPositionin interfaceICloseButton- Parameters:
x- x positiony- y position- Returns:
- this
ICloseButton
-
-