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 int
BOTTOM_RIGHT
private static int
DEFAULT_X
private static int
DEFAULT_Y
private java.awt.Color
fButtonBackgroundColor
private java.awt.Color
fButtonBorderColor
private java.awt.Rectangle
fButtonShape
private java.awt.BasicStroke
fStroke
private int
fX
private int
fY
private static int
SIZE
static int
STROKE_WIDTH
static int
TOP_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 boolean
isMouseOverCloseButton(java.awt.Point mousePosition)
Test if the mouse is over the close buttonvoid
paintCloseButton(java.awt.Graphics g)
Paint the close buttonICloseButton
withPosition(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:ICloseButton
Paint the close button- Specified by:
paintCloseButton
in interfaceICloseButton
- Parameters:
g
-Graphics
to paint on
-
isMouseOverCloseButton
public boolean isMouseOverCloseButton(java.awt.Point mousePosition)
Description copied from interface:ICloseButton
Test if the mouse is over the close button- Specified by:
isMouseOverCloseButton
in 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:ICloseButton
Set the position of the close button- Specified by:
withPosition
in interfaceICloseButton
- Parameters:
x
- x positiony
- y position- Returns:
- this
ICloseButton
-
-