June 2005
Beginner to intermediate
336 pages
6h 29m
English
All the user needs to do to open an image file is to use the File menu's Open… item. When the user selects that item, the actionPerformed method is called. Then, after making sure the Open… item was selected, the code sets the dialog object's mode to FileDialog.LOAD and makes the dialog box visible with the dialog.setVisible(true) call:
public void actionPerformed(ActionEvent event)
{
if(event.getSource() == menuitem1){
dialog.setMode(FileDialog.LOAD);
dialog.setVisible(true);
.
.
.
Setting the File dialog box's mode to FileDialog.LOAD (the only other option is FileDialog.SAVE) makes the dialog box display the File Open dialog box you see in Figure 3.2.
You can see the ...
Read now
Unlock full access