|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.croftsoft.core.gui.LifecycleWindowListener
public final class LifecycleWindowListener
Calls the lifecycle methods in response to windowing events.
When the window is activated, calls the start() methods. When the window is deactivated, calls the stop() methods. The first time the window is activated, the init() method will be called.
Performs the following upon the window closing event:
Example:
jFrame.setDefaultCloseOperation (
javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE );
jFrame.addWindowListener (
new LifecycleWindowListener ( this, "Exit Program?" ) );
Constructor Summary | |
---|---|
LifecycleWindowListener(Lifecycle lifecycle)
Convenience constructor. |
|
LifecycleWindowListener(Lifecycle[] lifecycles)
Convenience constructor. |
|
LifecycleWindowListener(Lifecycle[] lifecycles,
String shutdownConfirmationPrompt)
Convenience constructor. |
|
LifecycleWindowListener(Lifecycle[] lifecycles,
String shutdownConfirmationPrompt,
String shutdownConfirmationTitle)
Main constructor. |
|
LifecycleWindowListener(Lifecycle lifecycle,
String shutdownConfirmationPrompt)
Convenience constructor. |
Method Summary | |
---|---|
static void |
launchAppletAsDesktopApp(JApplet applet,
String frameTitle,
String frameIconFilename,
ClassLoader classLoader,
boolean useFullScreenToggler,
Dimension frameSize,
String shutdownConfirmationPrompt)
|
static void |
launchFrameAsDesktopApp(JFrame jFrame,
Lifecycle[] lifecycles,
Dimension frameSize,
String shutdownConfirmationPrompt)
Associates a LifecycleWindowListener with the JFrame and launches. |
static void |
launchFrameAsDesktopApp(JFrame jFrame,
Lifecycle lifecycle,
Dimension frameSize,
String shutdownConfirmationPrompt)
|
static void |
main(String[] args)
Test and demonstration method. |
void |
windowActivated(WindowEvent windowEvent)
|
void |
windowClosed(WindowEvent windowEvent)
|
void |
windowClosing(WindowEvent windowEvent)
|
void |
windowDeactivated(WindowEvent windowEvent)
|
void |
windowDeiconified(WindowEvent windowEvent)
|
void |
windowIconified(WindowEvent windowEvent)
|
void |
windowOpened(WindowEvent windowEvent)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LifecycleWindowListener(Lifecycle[] lifecycles, String shutdownConfirmationPrompt, String shutdownConfirmationTitle)
lifecycles
- May be null.shutdownConfirmationPrompt
- If null, no shutdown confirmation prompt dialog will be given.shutdownConfirmationTitle
- If null, the shutdownConfirmationPrompt value will be used.public LifecycleWindowListener(Lifecycle[] lifecycles, String shutdownConfirmationPrompt)
this ( lifecycles, shutdownConfirmationPrompt, null );
public LifecycleWindowListener(Lifecycle lifecycle, String shutdownConfirmationPrompt)
this (
new Lifecycle [ ] { lifecycle },
shutdownConfirmationPrompt );
public LifecycleWindowListener(Lifecycle[] lifecycles)
this ( lifecycles, null );
public LifecycleWindowListener(Lifecycle lifecycle)
this ( new Lifecycle [ ] { lifecycle } );
Method Detail |
---|
public static void main(String[] args)
public static void launchFrameAsDesktopApp(JFrame jFrame, Lifecycle[] lifecycles, Dimension frameSize, String shutdownConfirmationPrompt)
In order to create a flexible JFrame subclass that can be run either as a stand-alone desktop application by itself or as a pop-up frame called from a currently running program, you will need to maintain the logic for handling these different modes of operation outside of the subclass itself. This method provides the logic for running a JFrame subclass as an independent desktop application.
This method associates a LifecycleWindowAdapter with the JFrame which will call the lifecycle methods in response to windowing events. It then launches the JFrame on the center of the screen.
lifecycles
- An optional array of Lifecycle objects to initialized upon
startup, started upon window activation, stopped upon window
deactivation, and destroyed upon shutdown. May be null.frameSize
- If null, a default value will be used based upon screen size.shutdownConfirmationPrompt
- If null, no confirmation prompt will be given.Lifecycle
public static void launchFrameAsDesktopApp(JFrame jFrame, Lifecycle lifecycle, Dimension frameSize, String shutdownConfirmationPrompt)
public static void launchAppletAsDesktopApp(JApplet applet, String frameTitle, String frameIconFilename, ClassLoader classLoader, boolean useFullScreenToggler, Dimension frameSize, String shutdownConfirmationPrompt)
public void windowActivated(WindowEvent windowEvent)
windowActivated
in interface WindowListener
public void windowClosed(WindowEvent windowEvent)
windowClosed
in interface WindowListener
public void windowClosing(WindowEvent windowEvent)
windowClosing
in interface WindowListener
public void windowDeactivated(WindowEvent windowEvent)
windowDeactivated
in interface WindowListener
public void windowDeiconified(WindowEvent windowEvent)
windowDeiconified
in interface WindowListener
public void windowIconified(WindowEvent windowEvent)
windowIconified
in interface WindowListener
public void windowOpened(WindowEvent windowEvent)
windowOpened
in interface WindowListener
|
CroftSoft Javadoc | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |