|
Groovy Documentation | |||||||
| FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
com.wordpress.tipsforjava.swing.BackgroundPanel
public class BackgroundPanel extends JPanel
Support custom painting on a panel in the form of a) images - that can be scaled, tiled or painted at original size b) non solid painting - that can be done by using a Paint object Also, any component added directly to this panel will be made non-opaque so that the custom painting can show through.
| Field Summary | |
|---|---|
static int |
ACTUAL
|
static int |
SCALED
|
static int |
TILED
|
private float |
alignmentX
|
private float |
alignmentY
|
private Image |
image
|
private boolean |
isTransparentAdd
|
private Paint |
painter
|
private int |
style
|
| Fields inherited from class JPanel | |
|---|---|
| WHEN_FOCUSED, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_IN_FOCUSED_WINDOW, UNDEFINED_CONDITION, TOOL_TIP_TEXT_KEY, TOP_ALIGNMENT, CENTER_ALIGNMENT, BOTTOM_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, WIDTH, HEIGHT, PROPERTIES, SOMEBITS, FRAMEBITS, ALLBITS, ERROR, ABORT |
| Fields inherited from class JComponent | |
|---|---|
| WHEN_FOCUSED, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_IN_FOCUSED_WINDOW, UNDEFINED_CONDITION, TOOL_TIP_TEXT_KEY, TOP_ALIGNMENT, CENTER_ALIGNMENT, BOTTOM_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, WIDTH, HEIGHT, PROPERTIES, SOMEBITS, FRAMEBITS, ALLBITS, ERROR, ABORT |
| Constructor Summary | |
BackgroundPanel()
|
|
BackgroundPanel(Image image)
|
|
BackgroundPanel(Image image, int style)
|
|
BackgroundPanel(Image image, int style, float alignmentX, float alignmentY)
|
|
BackgroundPanel(Paint painter)
|
|
| Method Summary | |
|---|---|
void
|
add(JComponent component)
|
void
|
add(JComponent component, Object constraints)
|
private void
|
drawActual(Graphics g)
|
private void
|
drawScaled(Graphics g)
|
private void
|
drawTiled(Graphics g)
|
private void
|
makeComponentTransparent(JComponent component)
|
protected void
|
paintComponent(Graphics g)
|
void
|
setImage(Image image)
|
void
|
setImageAlignmentX(float alignmentX)
|
void
|
setImageAlignmentY(float alignmentY)
|
void
|
setPaint(Paint painter)
|
void
|
setStyle(int style)
|
void
|
setTransparentAdd(boolean isTransparentAdd)
|
| Field Detail |
|---|
public static final int ACTUAL
public static final int SCALED
public static final int TILED
private float alignmentX
private float alignmentY
private Image image
private boolean isTransparentAdd
private Paint painter
private int style
| Constructor Detail |
|---|
public BackgroundPanel()
public BackgroundPanel(Image image)
public BackgroundPanel(Image image, int style)
public BackgroundPanel(Image image, int style, float alignmentX, float alignmentY)
public BackgroundPanel(Paint painter)
| Method Detail |
|---|
public void add(JComponent component)
public void add(JComponent component, Object constraints)
private void drawActual(Graphics g)
private void drawScaled(Graphics g)
private void drawTiled(Graphics g)
private void makeComponentTransparent(JComponent component)
protected void paintComponent(Graphics g)
public void setImage(Image image)
public void setImageAlignmentX(float alignmentX)
public void setImageAlignmentY(float alignmentY)
public void setPaint(Paint painter)
public void setStyle(int style)
public void setTransparentAdd(boolean isTransparentAdd)
Groovy Documentation