![]() |
Help: Display a file from a FileDialog
Help is available for each task, or you can go straight to the solution source code.
There is no help for this task. Task 2Create the connection to show the file dialog when the user presses the button.Select the Button and click the left mouse button. Select Connect, then actionPerformed(java.awt.event.ActionEvent) from the pop-up menu that appears. The mouse pointer changes to indicate that you are in the process of making a connection; complete the connection by clicking either mouse button on the FileDialog bean. From the pop-up menu that appears, select show(). Task 3Create the connection to dispose of the file dialog.You may wonder why the Button both shows and disposes of the file dialog. Here's a brief synopsis of what happens. First, notice that there are two connections that both have actionPerformed(java.awt.event.ActionEvent) as the source event. One connection has the show() method as its target, and the other has the dispose() method as its target. Once the show() method is called in the file dialog, the file dialog has control until the user selects the Open button or the Cancel button. After the user has selected one of these buttons, control returns to the DisplayFileDialog class, and the next action it takes is to hide the file dialog by calling its dispose() method. Select the Button and click the left mouse button. Select Connect->actionPerformed(java.awt.event.ActionEvent) from the pop-up menu that appears. Click either mouse button on the FileDialog bean. From the pop-up menu that appears, select dispose(). Task 4Create the connection to set the TextField to the file that was chosen.First, create a connection between the button's actionPerformedEvent and the label's text method. The connection that appears is incomplete: select the connection you just created and click the left mouse button. Select Connect->value then click the left mouse button on the FileDialog bean. Select file from the pop-up menu that appears. |
Copyright © 1996-1997 MageLang Institute. All Rights Reserved. |