Class SingleFrameExample5
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
static void
protected void
ready()
Runs after the startup has completed and the GUI is up and ready.void
setNextImageEnabled
(boolean nextImageEnabled) void
setPreviousImageEnabled
(boolean previousImageEnabled) protected void
startup()
Responsible for starting the application; for creating and showing the initial GUI.void
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
-
Constructor Details
-
SingleFrameExample5
public SingleFrameExample5()
-
-
Method Details
-
nextImage
-
previousImage
-
refreshImage
-
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 classApplication
- See Also:
-
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 classApplication
- See Also:
-
main
-