|
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.MarqueePanel
public class MarqueePanel extends JPanel
The MarqueePanel is used to scroll components from the right edge of the panel to the left edge. Scrolling is continuous. To simulate the scrolling of text you can simply add a JLabel to the panel. Various properties control the scrolling of the components on the panel. Changes to the properties are dynamic and will take effect the next time the components are scrolled.
| Field Summary | |
|---|---|
protected boolean |
paintChildren
|
private int |
preferredWidth
|
private int |
scrollAmount
|
private int |
scrollFrequency
|
protected int |
scrollOffset
|
private boolean |
scrollWhenFocused
|
protected boolean |
scrollingPaused
|
private Timer |
timer
|
private boolean |
wrap
|
private int |
wrapAmount
|
protected int |
wrapOffset
|
| 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 | |
MarqueePanel()
Convenience constructor that sets both the scroll frequency and scroll amount to a value of 5. |
|
MarqueePanel(int scrollFrequency, int scrollAmount)
Create an AnimatedIcon that will continuously cycle with the default (500ms). |
|
| Method Summary | |
|---|---|
void
|
actionPerformed(ActionEvent ae)
Adjust the offset of the components on the panel so it appears that they are scrolling from right to left. |
void
|
ancestorAdded(AncestorEvent e)
Get notified when the panel is added to a Window so we can use a WindowListener to automatically start the scrolling of the components. |
void
|
ancestorMoved(AncestorEvent e)
|
void
|
ancestorRemoved(AncestorEvent e)
|
Dimension
|
getMinimumSize()
|
Dimension
|
getPreferredSize()
|
int
|
getPreferredWidth()
|
int
|
getScrollAmount()
Get the scroll amount. |
int
|
getScrollFrequency()
Get the scroll frequency. |
int
|
getWrapAmount()
Get the wrap amount. |
boolean
|
isScrollWhenFocused()
Get the scroll only when visible property. |
boolean
|
isWrap()
Get the wrap property. |
void
|
paintChildren(Graphics g)
|
void
|
pauseScrolling()
The components will stop scrolling but will remain visible |
void
|
resumeScrolling()
The components will resume scrolling from where scrolling was stopped. |
void
|
setPreferredWidth(int preferredWidth)
Specify the preferred width on the panel. |
void
|
setScrollAmount(int scrollAmount)
Specify the scroll amount. |
void
|
setScrollFrequency(int scrollFrequency)
Specify the scroll frequency. |
void
|
setScrollWhenFocused(boolean scrollWhenFocused)
Specify the scrolling property for unfocused windows. |
void
|
setWrap(boolean wrap)
Specify the wrapping property. |
void
|
setWrapAmount(int wrapAmount)
Specify the wrapping amount. |
void
|
startScrolling()
Start scrolling the components on the panel. |
void
|
stopScrolling()
Stop scrolling the components on the panel. |
void
|
windowActivated(WindowEvent e)
|
void
|
windowClosed(WindowEvent e)
|
void
|
windowClosing(WindowEvent e)
|
void
|
windowDeactivated(WindowEvent e)
|
void
|
windowDeiconified(WindowEvent e)
|
void
|
windowIconified(WindowEvent e)
|
void
|
windowOpened(WindowEvent e)
|
| Field Detail |
|---|
protected boolean paintChildren
private int preferredWidth
private int scrollAmount
private int scrollFrequency
protected int scrollOffset
private boolean scrollWhenFocused
protected boolean scrollingPaused
private Timer timer
private boolean wrap
private int wrapAmount
protected int wrapOffset
| Constructor Detail |
|---|
public MarqueePanel()
public MarqueePanel(int scrollFrequency, int scrollAmount)
component - the component the icon will be painted onicons - the Icons to be painted as part of the animation
| Method Detail |
|---|
public void actionPerformed(ActionEvent ae)
public void ancestorAdded(AncestorEvent e)
public void ancestorMoved(AncestorEvent e)
public void ancestorRemoved(AncestorEvent e)
de public public Dimension getMinimumSize()
de public public Dimension getPreferredSize()
public int getPreferredWidth()
public int getScrollAmount()
public int getScrollFrequency()
public int getWrapAmount()
public boolean isScrollWhenFocused()
public boolean isWrap()
de public public void paintChildren(Graphics g)
public void pauseScrolling()
public void resumeScrolling()
public void setPreferredWidth(int preferredWidth)
preferredWidth - preferred width of the panel in pixels
public void setScrollAmount(int scrollAmount)
scrollAmount - scroll amount in pixels
public void setScrollFrequency(int scrollFrequency)
scrollFrequency - scroll frequency
public void setScrollWhenFocused(boolean scrollWhenFocused)
scrollWhenVisible - when true scrolling pauses when the window
loses focus. Scrolling will continue when
the window regains focus. When false
scrolling is continuous unless the window
is iconified.
public void setWrap(boolean wrap)
wrap - when true the start of the text will scroll in from the right
edge while the end of the text is still scrolling off the left
edge. Otherwise the panel must be clear of text before
will begin again from the right edge.
public void setWrapAmount(int wrapAmount)
wrapAmount - the amount in pixels
public void startScrolling()
public void stopScrolling()
public void windowActivated(WindowEvent e)
public void windowClosed(WindowEvent e)
public void windowClosing(WindowEvent e)
public void windowDeactivated(WindowEvent e)
public void windowDeiconified(WindowEvent e)
public void windowIconified(WindowEvent e)
public void windowOpened(WindowEvent e)
Groovy Documentation