Class InfiniteProgressPanel
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- de.ipk_gatersleben.bit.bi.edal.rmi.client.util.InfiniteProgressPanel
-
- All Implemented Interfaces:
java.awt.event.MouseListener
,java.awt.image.ImageObserver
,java.awt.MenuContainer
,java.io.Serializable
,java.util.EventListener
public class InfiniteProgressPanel extends javax.swing.JComponent implements java.awt.event.MouseListener
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected int
alphaLevel
Alpha level of the veil, used for fade in/out.protected java.lang.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 java.awt.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 java.lang.String
text
Message displayed below the circular shape.protected java.awt.geom.Area[]
ticker
Contains the bars composing the circular shape.-
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
-
Constructor Summary
Constructors Constructor 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 msInfiniteProgressPanel(java.lang.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 msInfiniteProgressPanel(java.lang.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 msInfiniteProgressPanel(java.lang.String text, int barsCount, float shield)
Creates a new progress panel with default values: 15 frames per second Fade in/out last 300 msInfiniteProgressPanel(java.lang.String text, int barsCount, float shield, float fps)
Creates a new progress panel with default values: Fade in/out last 300 msInfiniteProgressPanel(java.lang.String text, int barsCount, float shield, float fps, int rampDelay)
Creates a new progress panel.
-
Method Summary
Modifier and Type Method Description java.lang.String
getText()
Returns the current displayed message.void
interrupt()
Interrupts the animation, whatever its state is.void
mouseClicked(java.awt.event.MouseEvent e)
void
mouseEntered(java.awt.event.MouseEvent e)
void
mouseExited(java.awt.event.MouseEvent e)
void
mousePressed(java.awt.event.MouseEvent e)
void
mouseReleased(java.awt.event.MouseEvent e)
void
paintComponent(java.awt.Graphics g)
void
setHeight(int height)
void
setText(java.lang.String text)
Changes the displayed message at runtime.void
setWidth(int width)
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.-
Methods inherited from class javax.swing.JComponent
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, getUI, 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, updateUI
-
Methods inherited from class java.awt.Container
add, 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, validateTree
-
Methods inherited from class java.awt.Component
action, 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, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
ticker
protected java.awt.geom.Area[] ticker
Contains the bars composing the circular shape.
-
animation
protected java.lang.Thread animation
The animation thread is responsible for fade in/out and rotation.
-
started
protected boolean started
Notifies whether the animation is running or not.
-
alphaLevel
protected int alphaLevel
Alpha level of the veil, used for fade in/out.
-
rampDelay
protected int rampDelay
Duration of the veil's fade in/out.
-
shield
protected float shield
Alpha level of the veil.
-
text
protected java.lang.String text
Message displayed below the circular shape.
-
barsCount
protected int barsCount
Amount of bars composing the circular shape.
-
fps
protected float fps
Amount of frames per seconde. Lowers this to save CPU.
-
hints
protected java.awt.RenderingHints hints
Rendering hints to set anti aliasing.
-
-
Constructor Detail
-
InfiniteProgressPanel
public 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
public InfiniteProgressPanel(java.lang.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
- Parameters:
text
- The message to be displayed. Can be null or empty.
-
InfiniteProgressPanel
public InfiniteProgressPanel(java.lang.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
- Parameters:
text
- The message to be displayed. Can be null or empty.barsCount
- The amount of bars composing the circular shape
-
InfiniteProgressPanel
public InfiniteProgressPanel(java.lang.String text, int barsCount, float shield)
Creates a new progress panel with default values:- 15 frames per second
- Fade in/out last 300 ms
- Parameters:
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).
-
InfiniteProgressPanel
public InfiniteProgressPanel(java.lang.String text, int barsCount, float shield, float fps)
Creates a new progress panel with default values:- Fade in/out last 300 ms
- Parameters:
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.
-
InfiniteProgressPanel
public InfiniteProgressPanel(java.lang.String text, int barsCount, float shield, float fps, int rampDelay)
Creates a new progress panel.- Parameters:
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.
-
-
Method Detail
-
setWidth
public void setWidth(int width)
-
setHeight
public void setHeight(int height)
-
setText
public void setText(java.lang.String text)
Changes the displayed message at runtime.- Parameters:
text
- The message to be displayed. Can be null or empty.
-
getText
public java.lang.String getText()
Returns the current displayed message.- Returns:
- the text
-
start
public void start()
Starts the waiting animation by fading the veil in, then rotating the shapes. This method handles the visibility of the glass pane.
-
stop
public void stop()
Stops the waiting animation by stopping the rotation of the circular shape and then by fading out the veil. This methods sets the panel invisible at the end.
-
interrupt
public void interrupt()
Interrupts the animation, whatever its state is. You can use it when you need to stop the animation without running the fade out phase. This methods sets the panel invisible at the end.
-
paintComponent
public void paintComponent(java.awt.Graphics g)
- Overrides:
paintComponent
in classjavax.swing.JComponent
-
mouseClicked
public void mouseClicked(java.awt.event.MouseEvent e)
- Specified by:
mouseClicked
in interfacejava.awt.event.MouseListener
-
mousePressed
public void mousePressed(java.awt.event.MouseEvent e)
- Specified by:
mousePressed
in interfacejava.awt.event.MouseListener
-
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent e)
- Specified by:
mouseReleased
in interfacejava.awt.event.MouseListener
-
mouseEntered
public void mouseEntered(java.awt.event.MouseEvent e)
- Specified by:
mouseEntered
in interfacejava.awt.event.MouseListener
-
mouseExited
public void mouseExited(java.awt.event.MouseEvent e)
- Specified by:
mouseExited
in interfacejava.awt.event.MouseListener
-
-