|
||||||||||
PREV CLASS NEXT CLASS | 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.JLabel
org.jdesktop.swingx.JXBusyLabel
public class JXBusyLabel
A simple circular animation, useful for denoting an action is taking place that may take an unknown length of time to complete. Similar to an indeterminant JProgressBar, but with a different look.
For example:
JXFrame frame = new JXFrame("test", true);
JXBusyLabel label = new JXBusyLabel();
frame.add(label);
//...
label.setBusy(true);
Another more complicated example:
JXBusyLabel label = new JXBusyLabel(new Dimension(100,84));
BusyPainter painter = new BusyPainter(
new Rectangle2D.Float(0, 0,13.500001f,1),
new RoundRectangle2D.Float(12.5f,12.5f,59.0f,59.0f,10,10));
painter.setTrailLength(5);
painter.setPoints(31);
painter.setFrame(1);
label.setPreferredSize(new Dimension(100,84));
label.setIcon(new EmptyIcon(100,84));
label.setBusyPainter(painter);
Another example:
JXBusyLabel label = new MyBusyLabel(new Dimension(100, 84));
where MyBusyLabel is:
public class MyBusyLabel extends JXBusyLabel {
public MyBusyLabel(Dimension prefSize) {
super(prefSize);
}
protected BusyLabel createBusyLabel(Dimension dim) {
BusyPainter painter = new BusyPainter(
new Rectangle2D.Float(0, 0,13.500001f,1),
new RoundRectangle2D.Float(12.5f,12.5f,59.0f,59.0f,10,10));
painter.setTrailLength(5);
painter.setPoints(31);
painter.setFrame(1);
return painter;
}
}
Nested Class Summary | |
---|---|
static class |
JXBusyLabel.Direction
Direction is used to set the initial direction in which the animation starts. |
Nested classes/interfaces inherited from class javax.swing.JLabel |
---|
JLabel.AccessibleJLabel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
static String |
uiClassID
UI Class ID |
Fields inherited from class javax.swing.JLabel |
---|
labelFor |
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface javax.swing.SwingConstants |
---|
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
JXBusyLabel()
Creates a new instance of JXBusyLabel initialized to circular shape in bounds of 26 by 26 points. |
|
JXBusyLabel(Dimension dim)
Creates a new instance of JXBusyLabel initialized to the arbitrary size and using default circular progress indicator. |
Method Summary | |
---|---|
void |
addNotify()
Notifies this component that it now has a parent component. |
protected BusyPainter |
createBusyPainter(Dimension dim)
Create and return a BusyPpainter to use for the Label. |
protected void |
frameChanged()
|
BusyPainter |
getBusyPainter()
Returns the current BusyPainter. |
int |
getDelay()
|
String |
getUIClassID()
Returns the name of the L&F class that renders this component. |
protected void |
initPainter(Dimension dim)
Initialize the BusyPainter and (this) JXBusyLabel with the given preferred size. |
boolean |
isBusy()
Gets whether this JXBusyLabel is busy. |
void |
removeNotify()
Notifies this component that it no longer has a parent component. |
void |
setBusy(boolean busy)
Sets whether this JXBusyLabel instance should consider
itself busy. |
void |
setBusyPainter(BusyPainter busyPainter)
|
void |
setDelay(int delay)
|
void |
setDirection(JXBusyLabel.Direction dir)
Sets direction of rotation. |
void |
updateUI()
Notification from the UIManager that the L&F has changed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String uiClassID
Constructor Detail |
---|
public JXBusyLabel()
JXBusyLabel
initialized to circular shape in bounds of 26 by 26 points.
public JXBusyLabel(Dimension dim)
JXBusyLabel
initialized to the arbitrary size and using default circular progress indicator.
dim
- Preferred size of the label.Method Detail |
---|
public void setDirection(JXBusyLabel.Direction dir)
Direction.RIGHT
is the default
value. Direction is taken from the very top point so Direction.RIGHT
enables rotation clockwise.
dir
- Direction of rotation.protected void initPainter(Dimension dim)
dim
- The new Preferred Size for the BusyLabel.getBusyPainter()
,
setBusyPainter(BusyPainter)
protected BusyPainter createBusyPainter(Dimension dim)
dim
- Painter size.JLabel.getUI()
public boolean isBusy()
Gets whether this JXBusyLabel
is busy. If busy, then
the JXBusyLabel
instance will indicate that it is busy,
generally by animating some state.
public void setBusy(boolean busy)
Sets whether this JXBusyLabel
instance should consider
itself busy. A busy component may indicate that it is busy via animation,
or some other means.
busy
- whether this JXBusyLabel
instance should
consider itself busypublic void removeNotify()
javax.swing.JComponent
KeyboardAction
s
set up in the the chain of parent components are removed.
removeNotify
in class JComponent
JComponent.registerKeyboardAction(java.awt.event.ActionListener, java.lang.String, javax.swing.KeyStroke, int)
public void addNotify()
javax.swing.JComponent
KeyboardAction
event listeners.
addNotify
in class JComponent
JComponent.registerKeyboardAction(java.awt.event.ActionListener, java.lang.String, javax.swing.KeyStroke, int)
protected void frameChanged()
public final BusyPainter getBusyPainter()
createBusyPainter(Dimension)
method is called to create one. Afterwards,
initPainter(Dimension)
is called to update the BusyLabel
with the created BusyPainter.
createBusyPainter(Dimension)
,
initPainter(Dimension)
public final void setBusyPainter(BusyPainter busyPainter)
busyPainter
- the busyPainter to setpublic int getDelay()
public void setDelay(int delay)
delay
- the delay to setpublic void updateUI()
UIManager
that the L&F has changed.
Replaces the current UI object with the latest version from the
UIManager
.
updateUI
in class JLabel
JComponent.updateUI()
public String getUIClassID()
getUIClassID
in class JLabel
uiClassID
JComponent.getUIClassID()
,
UIDefaults.getUI(javax.swing.JComponent)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |