examples
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.
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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SingleFrameExample5
public SingleFrameExample5()
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)