Package examples
Class BlockingExample1
- java.lang.Object
-
public class BlockingExample1 extends SingleFrameApplication
A demo of the@Actionblock options for background task. It's an example of three of theAction.Blocktypes:@Action(block = Task.BlockingScope.ACTION) public Task blockAction() { ... } @Action(block = Task.BlockingScope.COMPONENT) public Task blockComponent() { ... } @Action(block = Task.BlockingScope.WINDOW) public Task blockWindow() { ... } @Action(block = Task.BlockingScope.APPLICATION) public Task blockApplication() { ... }The firstBlockingScope.ACTION@Actiondisables the correspondingActionwhileblockActionmethod runs. When you press the blockAction button or toolbar-button or menu item you'll observe that all of the components are disabled. TheBlockingScope.COMPONENTversion only disables the component that triggered the action. TheBlock.WINDOWmethod uses a custominputBlockerto temporarily block input to the by making the window's glass pane visible. And theTask.BlockingScope.APPLICATIONversion pops up a modal dialog for the action's duration. The blocking dialog's title/message/icon are defined by resources from the ResourceBundle namedBlockingExample1:BlockingDialog.title = Blocking Application BlockingDialog.message = Please wait patiently ... Action.BlockingDialog.icon = wait.png
All of the actions in this example just sleep for about 2 seconds, while periodically updating their Task's message/progress properties.
This class loads resources from the ResourceBundle called
BlockingExample1. It depends on the exampleStatusBarclass.- See Also:
ApplicationContext,Application,Action,Task,TaskMonitor,StatusBar
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.jdesktop.application.Application
Application.ExitListener
-
-
Constructor Summary
Constructors Constructor Description BlockingExample1()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description TaskblockAction()TaskblockApplication()TaskblockComponent()TaskblockWindow()static voidmain(java.lang.String[] args)protected voidstartup()Responsible for starting the application; for creating and showing the initial GUI.-
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, ready, removeExitListener
-
Methods inherited from class org.jdesktop.application.AbstractBean
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
-
-
-
Method Detail
-
startup
protected void startup()
Description copied from class:ApplicationResponsible for starting the application; for creating and showing the initial GUI.This method is called by the static
launchmethod, subclasses must override it. It runs on the event dispatching thread.- Specified by:
startupin classApplication- See Also:
Application.launch(java.lang.Class<T>, java.lang.String[]),Application.initialize(java.lang.String[]),Application.shutdown()
-
blockApplication
@Action(block=APPLICATION) public Task blockApplication()
-
main
public static void main(java.lang.String[] args)
-
-