Class SingleFrameExample5
- java.lang.Object
-
- org.jdesktop.application.AbstractBean
-
- org.jdesktop.application.Application
-
- org.jdesktop.application.SingleFrameApplication
-
- 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
Constructors Constructor Description SingleFrameExample5()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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
-
-
-
-
Method Detail
-
nextImage
@Action(enabledProperty="nextImageEnabled") public Task nextImage()
-
previousImage
@Action(enabledProperty="previousImageEnabled") public Task previousImage()
-
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 classApplication
- See Also:
Application.launch(java.lang.Class<T>, 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 classApplication
- See Also:
Application.launch(java.lang.Class<T>, java.lang.String[])
,Application.startup()
,Application.shutdown()
-
main
public static void main(java.lang.String[] args)
-
-