Package org.emrick.project
Class ScrubBarGUI
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
org.emrick.project.ScrubBarGUI
- All Implemented Interfaces:
ActionListener
,ImageObserver
,MenuContainer
,Serializable
,EventListener
- 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
FieldsModifier and TypeFieldDescriptionprivate JCheckBox
private ArrayList<AudioPlayer>
private AudioPlayer
private int
private int
private long
private final FootballFieldPanel
private double
private boolean
private boolean
private int
private JButton
private JButton
private final JFrame
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
static final String
private static final String
private static final String
private static final String
private final ImageIcon
private final ImageIcon
private JButton
private JButton
private JButton
private final ScrubBarListener
private JPanel
private JButton
private final SyncListener
private double
private ArrayList<SyncTimeGUI.Pair>
private JSlider
private int
private boolean
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
ConstructorsConstructorDescriptionScrubBarGUI
(JFrame parent, ScrubBarListener scrubBarListener, SyncListener syncListener, FootballFieldPanel footballFieldPanel, ArrayList<AudioPlayer> audioPlayers) -
Method Summary
Modifier and TypeMethodDescriptionvoid
int
int
int
double
getFps()
double
getTime()
private JPanel
private void
boolean
boolean
boolean
boolean
boolean
isUseFps()
void
void
nextSet()
boolean
nextStep
(double playbackSpeed) void
void
prevSet()
private void
Upon receiving new pageTab2Count data, call this method to update the Scrub Bar.private ImageIcon
scaleImageIcon
(ImageIcon imageIcon) static ImageIcon
scaleImageIcon
(ImageIcon imageIcon, int width, int height) Rescale ImageIcon to fit for toolbar icons, or for other purposesvoid
setAudioPlayer
(ArrayList<AudioPlayer> audioPlayers) void
void
void
void
void
setPlaying
(boolean playing) void
setReady
(boolean ready) boolean
setScrub
(int count) void
setTime
(int time) void
setTimeSync
(ArrayList<SyncTimeGUI.Pair> timeSync) Takes in a map of [String]:[Integer] entries and returns a list of those entries, sorted by the value [Integer] in ascending order.private void
Call this method to update currSetBeginCount and currSetEndCount, which are important for displaying Count values on the bottom Scrub Bar.private void
Update lastCount field.void
updatePageTabCounts
(Map<String, Integer> pageTabCounts, int totalCounts) 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, paintComponent, 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 Details
-
PATH_SYNC_ICON
-
PATH_PREV_SET_ICON
-
PATH_NEXT_SET_ICON
-
PATH_PLAY_ICON
-
PATH_PAUSE_ICON
-
PATH_PREV_COUNT_ICON
-
PATH_NEXT_COUNT_ICON
-
PATH_AUDIO_ICON
-
PATH_FAST_PLAY_ICON
-
PATH_FULL_PLAY_ICON
-
scrubBarPanel
-
parent
-
audioPlayers
-
currAudioPlayer
-
currTimeMSec
private long currTimeMSec -
topSlider
-
isReady
private boolean isReady -
isPlaying
private boolean isPlaying -
syncButton
-
prevSetButton
-
nextSetButton
-
playPauseButton
-
prevCountButton
-
nextCountButton
-
playbackSpeedsBox
-
audioCheckbox
-
pageTab2Count
-
lastCount
private int lastCount -
currSetStartCount
private int currSetStartCount -
currSetEndCount
private int currSetEndCount -
footballFieldPanel
-
totalCounts
private int totalCounts -
scrubBarListener
-
syncListener
-
PLAY_ICON
-
PAUSE_ICON
-
fps
private double fps -
time
private double time -
useFps
private boolean useFps -
timeSync
-
-
Constructor Details
-
ScrubBarGUI
public ScrubBarGUI(JFrame parent, ScrubBarListener scrubBarListener, SyncListener syncListener, FootballFieldPanel footballFieldPanel, ArrayList<AudioPlayer> audioPlayers)
-
-
Method Details
-
updatePageTabCounts
-
reinitialize
private void reinitialize()Upon receiving new pageTab2Count data, call this method to update the Scrub Bar. -
updateLastCount
private void updateLastCount()Update lastCount field. Important for managing display of the bottom slider. Call this whenever the Scrub Bar receives a new set of Page Tab : Count data. i.e., upon receiving new data for pageTabCount. -
initialize
private void initialize() -
setScrub
public boolean setScrub(int count) -
setPlaybackTime
public void setPlaybackTime() -
nextStep
public boolean nextStep(double playbackSpeed) -
buildLabelTable
-
sortMap
Takes in a map of [String]:[Integer] entries and returns a list of those entries, sorted by the value [Integer] in ascending order. Useful for a variety of situations, not only within this class.- Parameters:
map
- - The map of [String]:[Integer] entries- Returns:
- a list of map entries, sorted by the value [Integer] in ascending order.
-
getToolBarPanel
-
scaleImageIcon
Rescale ImageIcon to fit for toolbar icons, or for other purposes- Parameters:
imageIcon
- - ImageIcon object to rescale.- Returns:
- Altered ImageIcon with rescaled icon.
-
scaleImageIcon
-
setReady
public void setReady(boolean ready) -
setPlaying
public void setPlaying(boolean playing) -
getScrubBarPanel
-
getAudioCheckbox
-
isUseFps
public boolean isUseFps() -
updateCurrSetCounts
Call this method to update currSetBeginCount and currSetEndCount, which are important for displaying Count values on the bottom Scrub Bar. Provide the Page Tab of the Set (a Page Tab denotes the start of a new Set). Implementation Details: If you provide: "2", then consider "2A" or "3" as next Page Tab, "2A", then consider "2B" or "3" as next Page Tab, "2Z", then consider "3" as next Page Tab, By knowing the current Page Tab and next Page Tab, we find the beginning and end Counts for the given set. (Technically the parameter is the Page Tab String).- Parameters:
set
- - For example, "1", "2A", "5B"
-
isPlaying
public boolean isPlaying() -
actionPerformed
- Specified by:
actionPerformed
in interfaceActionListener
-
setIsPlayingPause
public void setIsPlayingPause() -
setIsPlayingPlay
public void setIsPlayingPlay() -
getTime
public double getTime() -
prevSet
public void prevSet() -
nextSet
public void nextSet() -
prevCount
public void prevCount() -
nextCount
public void nextCount() -
getFps
public double getFps() -
getCurrentSetIndex
public int getCurrentSetIndex() -
getCurrentSetStart
public int getCurrentSetStart() -
isAtLastSet
public boolean isAtLastSet() -
isAtStartOfSet
public boolean isAtStartOfSet() -
isAtFirstSet
public boolean isAtFirstSet() -
getCurrSetDuration
public int getCurrSetDuration() -
setTimeSync
-
setAudioPlayer
-
setCurrAudioPlayer
-
setTime
public void setTime(int time) -
getSyncButton
-