Package se.datadosen.component
Class JProgressSpinner
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
se.datadosen.component.JProgressSpinner
- All Implemented Interfaces:
ImageObserver
,MenuContainer
,Serializable
Provide a Mac-like spinning wheel during long processes
- See Also:
-
Nested Class Summary
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.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Field Summary
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
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
Constructor Summary
ConstructorDescriptionJProgressSpinner
(boolean spinning) JProgressSpinner
(int preferredSize) JProgressSpinner
(int preferredSize, boolean spinning) JProgressSpinner
(int preferredSize, javafx.beans.binding.BooleanExpression model) JProgressSpinner
(javafx.beans.binding.BooleanExpression model) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Move most recent tick mark one step clockwiseint
getDelay()
Get time between animation framesjavafx.beans.binding.BooleanExpression
getModel()
int
getPhase()
boolean
isHidden()
Tell if ticks are showingboolean
Is there an ongoing animation?static void
protected void
void
setDelay
(int delay) Set time between animation framesvoid
setHidden
(boolean hidden) Decide if ticks are to show.void
setModel
(javafx.beans.binding.BooleanExpression model) void
setPhase
(int phase) Set angle on most recent tick markvoid
setSpinning
(boolean spinning) Decide if progress spinner is to animate or notvoid
setVisible
(boolean visible) void
workDone()
void
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, 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, 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 Details
-
nticks
public static final int nticks- See Also:
-
prefSize
public int prefSize
-
-
Constructor Details
-
JProgressSpinner
public JProgressSpinner() -
JProgressSpinner
public JProgressSpinner(int preferredSize, boolean spinning) -
JProgressSpinner
public JProgressSpinner(int preferredSize) -
JProgressSpinner
public JProgressSpinner(boolean spinning) -
JProgressSpinner
public JProgressSpinner(javafx.beans.binding.BooleanExpression model) - Parameters:
model
-- Since:
- 13
-
JProgressSpinner
public JProgressSpinner(int preferredSize, javafx.beans.binding.BooleanExpression model) - Parameters:
model
-- Since:
- 13
-
-
Method Details
-
setModel
public void setModel(javafx.beans.binding.BooleanExpression model) -
getModel
public javafx.beans.binding.BooleanExpression getModel() -
paintComponent
- Overrides:
paintComponent
in classJComponent
-
getPhase
public int getPhase()- Returns:
- Current phase (angle of most recent tick mark)
-
setPhase
public void setPhase(int phase) Set angle on most recent tick mark- Parameters:
phase
- number between 0 and nTicks-1
-
advancePhase
public void advancePhase()Move most recent tick mark one step clockwise -
getDelay
public int getDelay()Get time between animation frames- Returns:
- time in ms
-
setDelay
public void setDelay(int delay) Set time between animation frames- Parameters:
delay
- delay in ms
-
isHidden
public boolean isHidden()Tell if ticks are showing -
setHidden
public void setHidden(boolean hidden) Decide if ticks are to show. Available as an alternative to setVisible as setVisible(false) cases the layout manager to ignore reserving space for component -
setVisible
public void setVisible(boolean visible) - Overrides:
setVisible
in classJComponent
-
workStarted
public void workStarted() -
workDone
public void workDone() -
isSpinning
public boolean isSpinning()Is there an ongoing animation? -
setSpinning
public void setSpinning(boolean spinning) Decide if progress spinner is to animate or not -
getPreferredSize
- Overrides:
getPreferredSize
in classJComponent
-
main
-