public class PointingBorder
extends javax.swing.border.AbstractBorder
Modifier and Type | Class and Description |
---|---|
static class |
PointingBorder.Direction |
Constructor and Description |
---|
PointingBorder(PointingBorder.Direction direction)
Create a border with a point on it that points in the given direction.
|
Modifier and Type | Method and Description |
---|---|
java.awt.Insets |
getBorderInsets(java.awt.Component c) |
java.awt.Insets |
getBorderInsets(java.awt.Component c,
java.awt.Insets insets)
Reinitializes the insets parameter with this Border's current Insets.
|
PointingBorder.Direction |
getDirection() |
boolean |
isBorderOpaque() |
protected void |
paintBackground(java.awt.Graphics2D g2,
java.awt.Component c,
java.awt.Shape s)
Paint the background internal area of the pointing border.
|
void |
paintBorder(java.awt.Component c,
java.awt.Graphics g,
int x,
int y,
int width,
int height) |
void |
setBorderColor(java.awt.Color color)
Define the color used to render the border.
|
void |
setDirection(PointingBorder.Direction direction)
The component will need to be repainted after the direction is changed.
|
void |
setPointSize(int width,
int height)
Set the dimensions (in pixels) of the pointy part of the border.
|
void |
setXOffset(int offset)
By default the pointing part of the border appears centered for UP/DOWN directions.
|
void |
setYOffset(int offset)
By default the pointing part of the border appears centered for LEFT/RIGHT directions.
|
public PointingBorder(PointingBorder.Direction direction)
direction
- public void setPointSize(int width, int height)
width
- the width of the pointheight
- the height of the pointpublic void setDirection(PointingBorder.Direction direction)
direction
- the direction the border points inpublic void setBorderColor(java.awt.Color color)
color
- public PointingBorder.Direction getDirection()
public java.awt.Insets getBorderInsets(java.awt.Component c)
getBorderInsets
in interface javax.swing.border.Border
getBorderInsets
in class javax.swing.border.AbstractBorder
public java.awt.Insets getBorderInsets(java.awt.Component c, java.awt.Insets insets)
getBorderInsets
in class javax.swing.border.AbstractBorder
c
- the component for which this border insets value appliesinsets
- the object to be reinitializedinsets
objectpublic void paintBorder(java.awt.Component c, java.awt.Graphics g, int x, int y, int width, int height)
paintBorder
in interface javax.swing.border.Border
paintBorder
in class javax.swing.border.AbstractBorder
protected void paintBackground(java.awt.Graphics2D g2, java.awt.Component c, java.awt.Shape s)
g2
- c
- The component to be painteds
- The shape of the pointed borderpublic boolean isBorderOpaque()
isBorderOpaque
in interface javax.swing.border.Border
isBorderOpaque
in class javax.swing.border.AbstractBorder
public void setXOffset(int offset)
offset
- the number of pixels to move the point to the right from centerpublic void setYOffset(int offset)
offset
- the number of pixels to move the point downwards from center