|
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.blogofbug.swing.components.GradientPanel
public class GradientPanel extends JPanel
Container that draws (in an optimized way) a gradient in the background
| Field Summary | |
|---|---|
protected BufferedImage |
cache
A pre-rendered gradient in an image |
protected Color |
end
Gradient end color |
protected GradientPaint |
gp
Gradient painter |
protected Color |
start
Gradient start colour |
| 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 | |
GradientPanel()
|
|
| Method Summary | |
|---|---|
void
|
componentHidden(ComponentEvent componentEvent)
Not used * |
void
|
componentMoved(ComponentEvent componentEvent)
Not used * |
void
|
componentResized(ComponentEvent componentEvent)
Recalculates the gradient when it's resized |
void
|
componentShown(ComponentEvent componentEvent)
Ignored |
private void
|
makeGradient()
Pre-renders the gradient |
void
|
paintComponent(Graphics graphics)
paints the gradient. |
void
|
setBackground(Color color)
Set the background to a single color |
void
|
setBackground(Color start, Color end)
Sets two background colors for a gradient |
| Field Detail |
|---|
protected BufferedImage cache
protected Color end
protected GradientPaint gp
protected Color start
| Constructor Detail |
|---|
GradientPanel()
| Method Detail |
|---|
public void componentHidden(ComponentEvent componentEvent)
componentEvent - The event
public void componentMoved(ComponentEvent componentEvent)
componentEvent - The event
public void componentResized(ComponentEvent componentEvent)
componentEvent - The event object
public void componentShown(ComponentEvent componentEvent)
componentEvent - The component event
private void makeGradient()
public void paintComponent(Graphics graphics)
graphics - The graphics context
public void setBackground(Color color)
color - The color for a solid background
public void setBackground(Color start, Color end)
start - Top (first) colorend - Bottom (final) color
Groovy Documentation