javazoom.jlgui.player.amp
Class Player

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by javax.swing.JFrame
                      extended by javazoom.jlgui.player.amp.Player
All Implemented Interfaces:
java.awt.dnd.DropTargetListener, java.awt.event.ActionListener, java.awt.event.WindowListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants, javazoom.jlgui.basicplayer.BasicPlayerListener

public class Player
extends javax.swing.JFrame
implements java.awt.event.ActionListener, javazoom.jlgui.basicplayer.BasicPlayerListener, java.awt.dnd.DropTargetListener, java.awt.event.WindowListener

Player is the core UI (front-end) of jlGui. It is WinAmp skins 2.0 compliant.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
 
Nested classes/interfaces inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected static boolean autoRun
           
static int INIT
           
protected static java.lang.String initConfig
           
protected static java.lang.String initSong
           
static int OPEN
           
static int PAUSE
           
static int PLAY
           
protected static long SCROLL_PERIOD
           
protected static java.lang.String showDsp
           
protected static java.lang.String showEqualizer
           
protected static java.lang.String showPlaylist
           
protected static java.lang.String skinVersion
           
static int STOP
           
protected static int TEXT_LENGTH_MAX
           
protected static java.lang.String TITLETEXT
           
 
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
Player(java.lang.String Skin, java.lang.String title)
          Constructor.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Manages events.
protected  void closePlayer()
          Free ressources and close the player.
 void displayAll()
          Force display of all components.
 void dragEnter(java.awt.dnd.DropTargetDragEvent e)
          DnD : dragEnter implementation.
 void dragExit(java.awt.dnd.DropTargetEvent e)
          DnD : dragExit implementation.
 void dragOver(java.awt.dnd.DropTargetDragEvent e)
          DnD : dragOver implementation.
 void drop(java.awt.dnd.DropTargetDropEvent e)
          DnD : Drop implementation.
 void dropActionChanged(java.awt.dnd.DropTargetDragEvent e)
          DnD : dropActionChanged implementation.
 void exit(int status)
          Kills the player.
 SpectrumTimeAnalyzer getAnalyzer()
          Return built-in analyzer.
 Config getConfig()
          Return Config instance.
 javazoom.jlgui.basicplayer.BasicController getController()
          Return player controller.
 java.lang.String getCurrentTitle()
          Return current title in player.
 Equalizer getEqualizerUI()
          Return equalizer UI.
 int getPlayerState()
          Returns Player state.
 Playlist getPlaylist()
          Returns Playlist instance.
 MP3Files getPlaylistUI()
          Return playlist UI.
 java.lang.String getSkinReadme()
          Return readme content from skin.
 long getTimeLengthEstimation(java.util.Map properties)
          Try to compute time length in milliseconds.
static javax.swing.JFrame getTopFrame()
           
 java.lang.String getVisColors()
          Return visual colors from skin.
protected  boolean isDragOk(java.awt.dnd.DropTargetDragEvent e)
          Checks if Drag allowed.
 boolean isOpaque()
           
 boolean loadPlaylist(java.lang.String playlistName)
          Loads a new playlist.
 void loadSkin(java.io.InputStream skinStream)
          Loads a new skin from any input stream.
protected  void loadSkin(SkinLoader skl)
          Loads a skin from a SkinLoader.
 void loadSkin(java.lang.String skinName)
          Loads a new skin from local file system.
static void main(java.lang.String[] args)
          Entry point.
 void opened(java.lang.Object stream, java.util.Map properties)
          Open callback, stream is ready to play.
protected  java.io.File openFile(java.lang.String file)
          Returns a File from a filename.
 void paint(java.awt.Graphics g)
           
 void pressEject()
          Simulates "Eject" selection.
 void pressNext()
          Simulates "Next" selection.
 void pressPause()
          Simulates "Pause" selection.
 void pressPrevious()
          Simulates "Previous" selection.
 void pressStart()
          Simulates "Play" selection.
 void pressStop()
          Simulates "Stop" selection.
protected  void processSeek()
          Process seek feature.
 void progress(int bytesread, long microseconds, byte[] pcmdata, java.util.Map properties)
          Progress callback while playing.
 void readPanel(java.awt.Image[] releasedImage, int[] releasedPanel, java.awt.Image[] pressedImage, int[] pressedPanel, java.awt.Image imPanel)
          Crop Panel Features from image file.
protected  void setButtonsPanel()
          Instantiate Buttons Panel with ActiveComponent.
 void setController(javazoom.jlgui.basicplayer.BasicController controller)
          A handle to the BasicPlayer, plugins may control the player through the controller (play, stop, ...)
 void setCurrentSong(PlaylistItem pli)
          Sets the current song to play and start playing if needed.
protected  void setEPSRButtonsPanel()
          Instantiate EPSR Buttons Panel with ActiveComponent.
protected  void setExitPanel()
          Instantiate Exit Panel with ActiveComponent.
protected  void setMinimizePanel()
          Instantiate Minimize Panel with ActiveComponent.
protected  void setPosBarPanel()
          Instantiate PosBar Panel with ActiveComponent.
 void setSkin(java.lang.String sk)
          Sets skin filename.
protected  void setTitleBarPanel()
          Instantiate Title Panel with ActiveComponent.
protected  void setVolumeBalancePanel(int vheight, int bheight)
          Instantiate Volume/Balance Panel with ActiveComponent.
 void showMessage(java.lang.String titleText)
          Shows message in title an updates bitRate,sampleRate, Mono/Stereo,time features.
 void showTitle(java.lang.String titleText)
           
 void stateUpdated(javazoom.jlgui.basicplayer.BasicPlayerEvent event)
          Notification callback.
 void update(java.awt.Graphics g)
           
protected static void usage(java.lang.String msg)
          Displays usage.
 void windowActivated(java.awt.event.WindowEvent e)
          Invoked when the window is set to be the user's active window, which means the window (or one of its subcomponents) will receive keyboard events.
 void windowClosed(java.awt.event.WindowEvent e)
          Invoked when a window has been closed as the result of calling dispose on the window
 void windowClosing(java.awt.event.WindowEvent e)
          Invoked when the user attempts to close the window from the window's system menu.
 void windowDeactivated(java.awt.event.WindowEvent e)
          Invoked when a window is no longer the user's active window, which means that keyboard events will no longer be delivered to the window or its subcomponents
 void windowDeiconified(java.awt.event.WindowEvent e)
          Invoked when a window is changed from a minimized to a normal state.
 void windowIconified(java.awt.event.WindowEvent e)
          Invoked when a window is changed from a normal to a minimized state.
 void windowOpened(java.awt.event.WindowEvent e)
          Invoked the first time a window is made visible.
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled
 
Methods inherited from class java.awt.Frame
addNotify, finalize, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setAlwaysOnTop, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationByPlatform, setLocationRelativeTo, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, 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, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

TEXT_LENGTH_MAX

protected static int TEXT_LENGTH_MAX

SCROLL_PERIOD

protected static long SCROLL_PERIOD

TITLETEXT

protected static java.lang.String TITLETEXT

initConfig

protected static java.lang.String initConfig

initSong

protected static java.lang.String initSong

showPlaylist

protected static java.lang.String showPlaylist

showEqualizer

protected static java.lang.String showEqualizer

showDsp

protected static java.lang.String showDsp

skinVersion

protected static java.lang.String skinVersion

autoRun

protected static boolean autoRun

INIT

public static final int INIT
See Also:
Constant Field Values

OPEN

public static final int OPEN
See Also:
Constant Field Values

PLAY

public static final int PLAY
See Also:
Constant Field Values

PAUSE

public static final int PAUSE
See Also:
Constant Field Values

STOP

public static final int STOP
See Also:
Constant Field Values
Constructor Detail

Player

public Player(java.lang.String Skin,
              java.lang.String title)
Constructor.

Method Detail

getTopFrame

public static javax.swing.JFrame getTopFrame()

isOpaque

public boolean isOpaque()
Overrides:
isOpaque in class java.awt.Component

loadPlaylist

public boolean loadPlaylist(java.lang.String playlistName)
Loads a new playlist.


loadSkin

public void loadSkin(java.lang.String skinName)
Loads a new skin from local file system.


loadSkin

public void loadSkin(java.io.InputStream skinStream)
Loads a new skin from any input stream.


loadSkin

protected void loadSkin(SkinLoader skl)
                 throws java.lang.Exception
Loads a skin from a SkinLoader.

Throws:
java.lang.Exception

getSkinReadme

public java.lang.String getSkinReadme()
Return readme content from skin.

Returns:

getVisColors

public java.lang.String getVisColors()
Return visual colors from skin.

Returns:

getCurrentTitle

public java.lang.String getCurrentTitle()
Return current title in player.

Returns:

readPanel

public void readPanel(java.awt.Image[] releasedImage,
                      int[] releasedPanel,
                      java.awt.Image[] pressedImage,
                      int[] pressedPanel,
                      java.awt.Image imPanel)
Crop Panel Features from image file.


setButtonsPanel

protected void setButtonsPanel()
Instantiate Buttons Panel with ActiveComponent. Add them to window and ActionListener.


setTitleBarPanel

protected void setTitleBarPanel()
Instantiate Title Panel with ActiveComponent. Add them to window and ActionListener.


setExitPanel

protected void setExitPanel()
Instantiate Exit Panel with ActiveComponent. Add them to window and ActionListener.


setMinimizePanel

protected void setMinimizePanel()
Instantiate Minimize Panel with ActiveComponent. Add them to window and ActionListener.


setVolumeBalancePanel

protected void setVolumeBalancePanel(int vheight,
                                     int bheight)
Instantiate Volume/Balance Panel with ActiveComponent. Add them to window and ActionListener.


setPosBarPanel

protected void setPosBarPanel()
Instantiate PosBar Panel with ActiveComponent. Add them to window and ActionListener.


setEPSRButtonsPanel

protected void setEPSRButtonsPanel()
Instantiate EPSR Buttons Panel with ActiveComponent. Add them to window and ActionListener.


setCurrentSong

public void setCurrentSong(PlaylistItem pli)
Sets the current song to play and start playing if needed.


opened

public void opened(java.lang.Object stream,
                   java.util.Map properties)
Open callback, stream is ready to play.

Specified by:
opened in interface javazoom.jlgui.basicplayer.BasicPlayerListener

progress

public void progress(int bytesread,
                     long microseconds,
                     byte[] pcmdata,
                     java.util.Map properties)
Progress callback while playing.

Specified by:
progress in interface javazoom.jlgui.basicplayer.BasicPlayerListener

stateUpdated

public void stateUpdated(javazoom.jlgui.basicplayer.BasicPlayerEvent event)
Notification callback.

Specified by:
stateUpdated in interface javazoom.jlgui.basicplayer.BasicPlayerListener

setController

public void setController(javazoom.jlgui.basicplayer.BasicController controller)
A handle to the BasicPlayer, plugins may control the player through the controller (play, stop, ...)

Specified by:
setController in interface javazoom.jlgui.basicplayer.BasicPlayerListener

getController

public javazoom.jlgui.basicplayer.BasicController getController()
Return player controller.

Returns:

processSeek

protected void processSeek()
Process seek feature.


actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Manages events.

Specified by:
actionPerformed in interface java.awt.event.ActionListener

showMessage

public void showMessage(java.lang.String titleText)
Shows message in title an updates bitRate,sampleRate, Mono/Stereo,time features.


showTitle

public void showTitle(java.lang.String titleText)

paint

public void paint(java.awt.Graphics g)
Overrides:
paint in class java.awt.Container

update

public void update(java.awt.Graphics g)
Overrides:
update in class javax.swing.JFrame

windowActivated

public void windowActivated(java.awt.event.WindowEvent e)
Invoked when the window is set to be the user's active window, which means the window (or one of its subcomponents) will receive keyboard events.

Specified by:
windowActivated in interface java.awt.event.WindowListener

windowClosed

public void windowClosed(java.awt.event.WindowEvent e)
Invoked when a window has been closed as the result of calling dispose on the window

Specified by:
windowClosed in interface java.awt.event.WindowListener

windowClosing

public void windowClosing(java.awt.event.WindowEvent e)
Invoked when the user attempts to close the window from the window's system menu.

Specified by:
windowClosing in interface java.awt.event.WindowListener

windowDeactivated

public void windowDeactivated(java.awt.event.WindowEvent e)
Invoked when a window is no longer the user's active window, which means that keyboard events will no longer be delivered to the window or its subcomponents

Specified by:
windowDeactivated in interface java.awt.event.WindowListener

windowDeiconified

public void windowDeiconified(java.awt.event.WindowEvent e)
Invoked when a window is changed from a minimized to a normal state.

Specified by:
windowDeiconified in interface java.awt.event.WindowListener

windowIconified

public void windowIconified(java.awt.event.WindowEvent e)
Invoked when a window is changed from a normal to a minimized state.

Specified by:
windowIconified in interface java.awt.event.WindowListener

windowOpened

public void windowOpened(java.awt.event.WindowEvent e)
Invoked the first time a window is made visible.

Specified by:
windowOpened in interface java.awt.event.WindowListener

dragEnter

public void dragEnter(java.awt.dnd.DropTargetDragEvent e)
DnD : dragEnter implementation.

Specified by:
dragEnter in interface java.awt.dnd.DropTargetListener

dragOver

public void dragOver(java.awt.dnd.DropTargetDragEvent e)
DnD : dragOver implementation.

Specified by:
dragOver in interface java.awt.dnd.DropTargetListener

dragExit

public void dragExit(java.awt.dnd.DropTargetEvent e)
DnD : dragExit implementation.

Specified by:
dragExit in interface java.awt.dnd.DropTargetListener

dropActionChanged

public void dropActionChanged(java.awt.dnd.DropTargetDragEvent e)
DnD : dropActionChanged implementation.

Specified by:
dropActionChanged in interface java.awt.dnd.DropTargetListener

drop

public void drop(java.awt.dnd.DropTargetDropEvent e)
DnD : Drop implementation. Adds all dropped files to the playlist.

Specified by:
drop in interface java.awt.dnd.DropTargetListener

isDragOk

protected boolean isDragOk(java.awt.dnd.DropTargetDragEvent e)
Checks if Drag allowed.


getTimeLengthEstimation

public long getTimeLengthEstimation(java.util.Map properties)
Try to compute time length in milliseconds.


openFile

protected java.io.File openFile(java.lang.String file)
Returns a File from a filename.


setSkin

public void setSkin(java.lang.String sk)
Sets skin filename.


getPlaylist

public Playlist getPlaylist()
Returns Playlist instance.


getPlayerState

public int getPlayerState()
Returns Player state.


closePlayer

protected void closePlayer()
Free ressources and close the player.


exit

public void exit(int status)
Kills the player.


pressStart

public void pressStart()
Simulates "Play" selection.


pressPause

public void pressPause()
Simulates "Pause" selection.


pressStop

public void pressStop()
Simulates "Stop" selection.


pressNext

public void pressNext()
Simulates "Next" selection.


pressPrevious

public void pressPrevious()
Simulates "Previous" selection.


pressEject

public void pressEject()
Simulates "Eject" selection.


getPlaylistUI

public MP3Files getPlaylistUI()
Return playlist UI.

Returns:

getEqualizerUI

public Equalizer getEqualizerUI()
Return equalizer UI.

Returns:

displayAll

public void displayAll()
Force display of all components.


getConfig

public Config getConfig()
Return Config instance.

Returns:

getAnalyzer

public SpectrumTimeAnalyzer getAnalyzer()
Return built-in analyzer.

Returns:

main

public static void main(java.lang.String[] args)
Entry point.


usage

protected static void usage(java.lang.String msg)
Displays usage.



JavaZOOM 1999-2006