examples
Class SingleFrameExample5

java.lang.Object
  extended by org.jdesktop.application.AbstractBean
      extended by org.jdesktop.application.Application
          extended by org.jdesktop.application.SingleFrameApplication
              extended by examples.SingleFrameExample5

public class SingleFrameExample5
extends SingleFrameApplication

A demo of the Task class.

This demo highlights the importance of background tasks by downloading some very large Mars rover images from JPL's photojournal web site. There are about a dozen images, most with 10-15M pixels. Clicking the next/prev buttons (or control-N,P) cancels the current download and starts loading a new image. The stop button also cancels the current download. The list of images is defined in the startup() method. The first image is shown by the application's ready() method.

More images of Mars can be found here: http://photojournal.jpl.nasa.gov/target/Mars. Some of the MER images are quite large (like this 22348x4487 whopper, http://photojournal.jpl.nasa.gov/jpeg/PIA06917.jpg) and can't be loaded without reconfiguring the Java heap parameters.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.jdesktop.application.Application
Application.ExitListener
 
Constructor Summary
SingleFrameExample5()
           
 
Method Summary
 boolean isNextImageEnabled()
           
 boolean isPreviousImageEnabled()
           
static void main(java.lang.String[] args)
           
 Task nextImage()
           
 Task previousImage()
           
protected  void ready()
          Runs after the startup has completed and the GUI is up and ready.
 Task refreshImage()
           
 void setNextImageEnabled(boolean nextImageEnabled)
           
 void setPreviousImageEnabled(boolean previousImageEnabled)
           
protected  void startup()
          Responsible for starting the application; for creating and showing the initial GUI.
 void stopLoading()
           
 
Methods inherited from class org.jdesktop.application.SingleFrameApplication
configureWindow, getMainFrame, getMainView, setMainFrame, show, show, show, show, shutdown
 
Methods inherited from class org.jdesktop.application.Application
addExitListener, end, exit, exit, getContext, getExitListeners, getInstance, getInstance, hide, initialize, launch, quit, removeExitListener
 
Methods inherited from class org.jdesktop.application.AbstractBean
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SingleFrameExample5

public SingleFrameExample5()
Method Detail

nextImage

@Action(enabledProperty="nextImageEnabled")
public Task nextImage()

previousImage

@Action(enabledProperty="previousImageEnabled")
public Task previousImage()

refreshImage

@Action
public Task refreshImage()

stopLoading

@Action
public void stopLoading()

isNextImageEnabled

public boolean isNextImageEnabled()

setNextImageEnabled

public void setNextImageEnabled(boolean nextImageEnabled)

isPreviousImageEnabled

public boolean isPreviousImageEnabled()

setPreviousImageEnabled

public void setPreviousImageEnabled(boolean previousImageEnabled)

startup

protected void startup()
Description copied from class: Application
Responsible for starting the application; for creating and showing the initial GUI.

This method is called by the static launch method, subclasses must override it. It runs on the event dispatching thread.

Specified by:
startup in class Application
See Also:
Application.launch(java.lang.Class, java.lang.String[]), Application.initialize(java.lang.String[]), Application.shutdown()

ready

protected void ready()
Runs after the startup has completed and the GUI is up and ready. We show the first image here, rather than initializing it at startup time, so loading the first image doesn't impede getting the GUI visible.

Overrides:
ready in class Application
See Also:
Application.launch(java.lang.Class, java.lang.String[]), Application.startup(), Application.shutdown()

main

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