public class InfiniteProgressPanel extends JComponent implements MouseListener
start(), stop()
and interrupt() methods. InfiniteProgressPanel pane = new InfiniteProgressPanel(); frame.setGlassPane(pane); pane.start()
setFont() and setForeground().JComponent.AccessibleJComponentContainer.AccessibleAWTContainerComponent.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy| Modifier and Type | Field and Description |
|---|---|
protected int |
alphaLevel
Alpha level of the veil, used for fade in/out.
|
protected Thread |
animation
The animation thread is responsible for fade in/out and rotation.
|
protected int |
barsCount
Amount of bars composing the circular shape.
|
protected float |
fps
Amount of frames per seconde.
|
protected RenderingHints |
hints
Rendering hints to set anti aliasing.
|
protected int |
rampDelay
Duration of the veil's fade in/out.
|
protected float |
shield
Alpha level of the veil.
|
protected boolean |
started
Notifies whether the animation is running or not.
|
protected String |
text
Message displayed below the circular shape.
|
protected Area[] |
ticker
Contains the bars composing the circular shape.
|
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWaccessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH| Constructor and Description |
|---|
InfiniteProgressPanel()
Creates a new progress panel with default values:
No message 14 bars Veil's alpha level is 70% 15 frames per second Fade in/out last 300 ms |
InfiniteProgressPanel(String text)
Creates a new progress panel with default values:
14 bars Veil's alpha level is 70% 15 frames per second Fade in/out last 300 ms |
InfiniteProgressPanel(String text,
int barsCount)
Creates a new progress panel with default values:
Veil's alpha level is 70% 15 frames per second Fade in/out last 300 ms |
InfiniteProgressPanel(String text,
int barsCount,
float shield)
Creates a new progress panel with default values:
15 frames per second Fade in/out last 300 ms |
InfiniteProgressPanel(String text,
int barsCount,
float shield,
float fps)
Creates a new progress panel with default values:
Fade in/out last 300 ms |
InfiniteProgressPanel(String text,
int barsCount,
float shield,
float fps,
int rampDelay)
Creates a new progress panel.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getText()
Returns the current displayed message.
|
void |
interrupt()
Interrupts the animation, whatever its state is.
|
void |
mouseClicked(MouseEvent e) |
void |
mouseEntered(MouseEvent e) |
void |
mouseExited(MouseEvent e) |
void |
mousePressed(MouseEvent e) |
void |
mouseReleased(MouseEvent e) |
void |
paintComponent(Graphics g) |
void |
setText(String text)
Changes the displayed message at runtime.
|
void |
start()
Starts the waiting animation by fading the veil in, then rotating the
shapes.
|
void |
stop()
Stops the waiting animation by stopping the rotation of the circular
shape and then by fading out the veil.
|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUIadd, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTreeaction, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycleprotected Area[] ticker
protected Thread animation
protected boolean started
protected int alphaLevel
protected int rampDelay
protected float shield
protected String text
protected int barsCount
protected float fps
protected RenderingHints hints
public InfiniteProgressPanel()
public InfiniteProgressPanel(String text)
text - The message to be displayed. Can be null or empty.public InfiniteProgressPanel(String text, int barsCount)
text - The message to be displayed. Can be null or empty.barsCount - The amount of bars composing the circular shapepublic InfiniteProgressPanel(String text, int barsCount, float shield)
text - The message to be displayed. Can be null or empty.barsCount - The amount of bars composing the circular shape.shield - The alpha level between 0.0 and 1.0 of the colored shield (or
veil).public InfiniteProgressPanel(String text, int barsCount, float shield, float fps)
text - The message to be displayed. Can be null or empty.barsCount - The amount of bars composing the circular shape.shield - The alpha level between 0.0 and 1.0 of the colored shield (or
veil).fps - The number of frames per second. Lower this value to decrease
CPU usage.public InfiniteProgressPanel(String text, int barsCount, float shield, float fps, int rampDelay)
text - The message to be displayed. Can be null or empty.barsCount - The amount of bars composing the circular shape.shield - The alpha level between 0.0 and 1.0 of the colored shield (or
veil).fps - The number of frames per second. Lower this value to decrease
CPU usage.rampDelay - The duration, in milli seconds, of the fade in and the fade
out of the veil.public void setText(String text)
text - The message to be displayed. Can be null or empty.public String getText()
public void start()
public void stop()
public void interrupt()
public void paintComponent(Graphics g)
paintComponent in class JComponentpublic void mouseClicked(MouseEvent e)
mouseClicked in interface MouseListenerpublic void mousePressed(MouseEvent e)
mousePressed in interface MouseListenerpublic void mouseReleased(MouseEvent e)
mouseReleased in interface MouseListenerpublic void mouseEntered(MouseEvent e)
mouseEntered in interface MouseListenerpublic void mouseExited(MouseEvent e)
mouseExited in interface MouseListenerCopyright © 2006–2020 Dirk Lemmermann Software & Consulting. All rights reserved.