Class RoundCloseButton
- java.lang.Object
-
- ch.swingfx.twinkle.style.closebutton.RoundCloseButton
-
- All Implemented Interfaces:
ICloseButton
public class RoundCloseButton extends java.lang.Object implements ICloseButton
A simple round 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.geom.Ellipse2D.Double
fButtonShape
private java.awt.image.BufferedImage
fDropShadow
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 RoundCloseButton(java.awt.Color buttonBackgroundColor, java.awt.Color buttonBorderColor)
Create a RoundCloseButton at default x and yRoundCloseButton(java.awt.Color buttonBackgroundColor, java.awt.Color buttonBorderColor, int x, int y)
Create a RoundCloseButton at x and 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
-
STROKE_WIDTH
public static final int STROKE_WIDTH
- 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
-
fButtonShape
private java.awt.geom.Ellipse2D.Double fButtonShape
-
fStroke
private java.awt.BasicStroke fStroke
-
fButtonBackgroundColor
private java.awt.Color fButtonBackgroundColor
-
fButtonBorderColor
private java.awt.Color fButtonBorderColor
-
fDropShadow
private java.awt.image.BufferedImage fDropShadow
-
fX
private int fX
-
fY
private int fY
-
-
Constructor Detail
-
RoundCloseButton
public RoundCloseButton(java.awt.Color buttonBackgroundColor, java.awt.Color buttonBorderColor)
Create a RoundCloseButton at default x and y- Parameters:
buttonBackgroundColor
- the background color of the buttonbuttonBorderColor
- the border and X color of the button
-
RoundCloseButton
public RoundCloseButton(java.awt.Color buttonBackgroundColor, java.awt.Color buttonBorderColor, int x, int y)
Create a RoundCloseButton at x and y- Parameters:
buttonBackgroundColor
- the background color of the buttonbuttonBorderColor
- the border and X color of the buttonx
- x positiony
- y position
-
-
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
-
-