app
Class JApplication

java.lang.Object
  extended by app.JApplication
All Implemented Interfaces:
java.awt.event.WindowListener, java.lang.Runnable, java.util.EventListener, javax.swing.RootPaneContainer
Direct Known Subclasses:
MultimediaApplication

public abstract class JApplication
extends java.lang.Object
implements javax.swing.RootPaneContainer, java.lang.Runnable, java.awt.event.WindowListener

A JApplication is a swing application that looks and behaves like a JApplet Specializations of this class must implement the init() method. They may also implement the destroy(), start(), and stop() methods.

See Also:
"The Design and Implementation of Multimedia Software © 2011"

Field Summary
static byte[] icondata
           
protected  javax.swing.JFrame mainWindow
           
 
Constructor Summary
JApplication(int width, int height)
          Explicit Value Constructor
 
Method Summary
 void destroy()
          This method is called just after the main window is disposed.
 java.awt.Container getContentPane()
          Returns the content pane (required by RootPaneContainer)
 java.awt.Component getGlassPane()
          Returns the glass pane (required by RootPaneContainer)
 javax.swing.JLayeredPane getLayeredPane()
          Returns the layered pane (required by RootPaneContainer)
 javax.swing.JRootPane getRootPane()
          Returns the root pane (required by RootPaneContainer)
abstract  void init()
          This method is called just before the main window is first made visible
 void run()
          The actual entry point into this JApplication (required by Runnable) This method is called in the event dispatch thread.
 void setContentPane(java.awt.Container contentPane)
          Set the content pane (required by RootPaneContainer)
 void setGlassPane(java.awt.Component glassPane)
          Set the glass pane (required by RootPaneContainer)
 void setLayeredPane(javax.swing.JLayeredPane layeredPane)
          Set the layered pane (required by RootPaneContainer)
 void start()
          This method is called when the main window is first made visible and then each time it is de-iconified.
 void stop()
          This method is called each time the main window is iconified and just before it is disposed.
 void windowActivated(java.awt.event.WindowEvent event)
          Handle windowActivated messages -- when the windows gains the focus (required by WindowListener)
 void windowClosed(java.awt.event.WindowEvent event)
          Handle windowClosed messages -- when the window is disposed (required by WindowListener)
 void windowClosing(java.awt.event.WindowEvent event)
          Handle windowClosing messages (required by WindowListener)
 void windowDeactivated(java.awt.event.WindowEvent event)
          Handle windowDeactivated messages -- when the windows loses the focus (required by WindowListener)
 void windowDeiconified(java.awt.event.WindowEvent event)
          Handle windowDeiconified messages -- when the window is maximized (required by WindowListener)
 void windowIconified(java.awt.event.WindowEvent event)
          Handle windowIconified messages -- when the window is minimized (required by WindowListener)
 void windowOpened(java.awt.event.WindowEvent event)
          Handle windowOpened messages -- the first time the window is made visible (required by WindowListener)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mainWindow

protected javax.swing.JFrame mainWindow

icondata

public static byte[] icondata
Constructor Detail

JApplication

public JApplication(int width,
                    int height)
Explicit Value Constructor

Parameters:
width - The width of the content (in pixels)
height - The height of the content (in pixels)
Method Detail

destroy

public void destroy()
This method is called just after the main window is disposed. The default implementation does nothing.


getContentPane

public java.awt.Container getContentPane()
Returns the content pane (required by RootPaneContainer)

Specified by:
getContentPane in interface javax.swing.RootPaneContainer

getGlassPane

public java.awt.Component getGlassPane()
Returns the glass pane (required by RootPaneContainer)

Specified by:
getGlassPane in interface javax.swing.RootPaneContainer

getLayeredPane

public javax.swing.JLayeredPane getLayeredPane()
Returns the layered pane (required by RootPaneContainer)

Specified by:
getLayeredPane in interface javax.swing.RootPaneContainer

getRootPane

public javax.swing.JRootPane getRootPane()
Returns the root pane (required by RootPaneContainer)

Specified by:
getRootPane in interface javax.swing.RootPaneContainer

init

public abstract void init()
This method is called just before the main window is first made visible


run

public final void run()
The actual entry point into this JApplication (required by Runnable) This method is called in the event dispatch thread.

Specified by:
run in interface java.lang.Runnable

setContentPane

public void setContentPane(java.awt.Container contentPane)
Set the content pane (required by RootPaneContainer)

Specified by:
setContentPane in interface javax.swing.RootPaneContainer

setGlassPane

public void setGlassPane(java.awt.Component glassPane)
Set the glass pane (required by RootPaneContainer)

Specified by:
setGlassPane in interface javax.swing.RootPaneContainer

setLayeredPane

public void setLayeredPane(javax.swing.JLayeredPane layeredPane)
Set the layered pane (required by RootPaneContainer)

Specified by:
setLayeredPane in interface javax.swing.RootPaneContainer

start

public void start()
This method is called when the main window is first made visible and then each time it is de-iconified. The default implementation does nothing.


stop

public void stop()
This method is called each time the main window is iconified and just before it is disposed. The default implementation does nothing.


windowActivated

public void windowActivated(java.awt.event.WindowEvent event)
Handle windowActivated messages -- when the windows gains the focus (required by WindowListener)

Specified by:
windowActivated in interface java.awt.event.WindowListener
Parameters:
event - The WindowEvent that generated the message

windowClosed

public void windowClosed(java.awt.event.WindowEvent event)
Handle windowClosed messages -- when the window is disposed (required by WindowListener)

Specified by:
windowClosed in interface java.awt.event.WindowListener
Parameters:
event - The WindowEvent that generated the message

windowClosing

public void windowClosing(java.awt.event.WindowEvent event)
Handle windowClosing messages (required by WindowListener)

Specified by:
windowClosing in interface java.awt.event.WindowListener
Parameters:
event - The WindowEvent that generated the message

windowDeiconified

public void windowDeiconified(java.awt.event.WindowEvent event)
Handle windowDeiconified messages -- when the window is maximized (required by WindowListener)

Specified by:
windowDeiconified in interface java.awt.event.WindowListener
Parameters:
event - The WindowEvent that generated the message

windowDeactivated

public void windowDeactivated(java.awt.event.WindowEvent event)
Handle windowDeactivated messages -- when the windows loses the focus (required by WindowListener)

Specified by:
windowDeactivated in interface java.awt.event.WindowListener
Parameters:
event - The WindowEvent that generated the message

windowIconified

public void windowIconified(java.awt.event.WindowEvent event)
Handle windowIconified messages -- when the window is minimized (required by WindowListener)

Specified by:
windowIconified in interface java.awt.event.WindowListener
Parameters:
event - The WindowEvent that generated the message

windowOpened

public void windowOpened(java.awt.event.WindowEvent event)
Handle windowOpened messages -- the first time the window is made visible (required by WindowListener)

Specified by:
windowOpened in interface java.awt.event.WindowListener
Parameters:
event - The WindowEvent that generated the message


Design and Implementation of Multimedia Software, Jones and Bartlett Publishers