The Essential JViews Framework > Getting Started with JViews Framework > Step 3 - Using Events

The third part of the tutorial, the Sample3.java file, is an extension of the Sample2 file. Compile the Sample3.java file and run it as you did for the previous example files. See Running the Example.

images/sample3.png

Figure 2.3 Sample3 Running

In Step 3, we show the use of events delivered by the view. To demonstrate this we will use the InteractorListener interface which will allow us to listen for a change of interactors. There are three buttons in the example, each with an associated interactor. Clicking one button and then another changes the `engaged' interactor accordingly.

Two new interactors are placed on the view: IlvZoomViewInteractor and the IlvUnZoomViewInteractor. These interactors allow you to drag a rectangle on the view to zoom in and out on this area. The third interactor is the IlvSelectInteractor (of Sample2). Their respective buttons are created inside a Swing JPanel, which automatically aligns them as seen in the above illustration.