public class SingleFrameExample5 extends SingleFrameApplication
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.
Application.ExitListener
Constructor | Description |
---|---|
SingleFrameExample5() |
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() |
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
addExitListener, end, exit, exit, getContext, getExitListeners, getInstance, getInstance, hide, initialize, launch, quit, removeExitListener
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
configureWindow, getMainFrame, getMainView, setMainFrame, show, show, show, show, shutdown
@Action(enabledProperty="nextImageEnabled") public Task nextImage()
@Action(enabledProperty="previousImageEnabled") public Task previousImage()
@Action public void stopLoading()
public boolean isNextImageEnabled()
public void setNextImageEnabled(boolean nextImageEnabled)
public boolean isPreviousImageEnabled()
public void setPreviousImageEnabled(boolean previousImageEnabled)
protected void startup()
Application
This method is called by the static launch
method,
subclasses must override it. It runs on the event dispatching
thread.
startup
in class Application
Application.launch(java.lang.Class<T>, java.lang.String[])
,
Application.initialize(java.lang.String[])
,
Application.shutdown()
protected void ready()
ready
in class Application
Application.launch(java.lang.Class<T>, java.lang.String[])
,
Application.startup()
,
Application.shutdown()
public static void main(java.lang.String[] args)