Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

setAction actionPerformed additions?

Status
Not open for further replies.

Marichele

Programmer
Oct 17, 2002
45
US
Hi,

I'm new to Java.

I have a component from a class that references an action from another class. I want to fire one more step after the action is done(enable a button). FileBrowser is a class that allows the user to choose a directory. txtbtnlocation is a class of a textfield and a button.

FileBrowser browse = new FileBrowser(this, FileBrowser.DIRECTORIES_ONLY,FileBrowser.SAVE_DIALOG);

txtbtnLoc.setAction(browse);

I am just looking for some basic ideas of where to go from here. I don't want to change the existing class code at all, I suspect I will need to override the actionPerformed of FileBrowser, but I get a method missing error

Thanks in advance
 
Hi Marichele:

You must be a little more specific.

If I unterdstood you well, you want to enable the txtbtnLoc button when the user select a directory from FileBrowser.

If this is the case, it depends on the FileBrowser implementation. If, as I suposse, the FileBrowser acts like a normal JDialog, it must return an integer when you call showDialog or something similar. That integer must have a ACCEPT_BUTTON or CANCEL_BUTTON value. You just have to analyze this value and in case of an ACCEPT_BUTTON call the txtbtnLoc.button.setEnabled(true) directive.

But, again, I don't know if that's what you need.

Hope it helps.
 
Thanks for replying so quickly but I solved the issue.

very simply, I did a Method call of the superclass...

private class FileBrowserLocation extends FileBrowser
{
public void actionPerformed(ActionEvent pEvent) {
>> super.actionPerformed(pEvent); // Method call of the superclass
locationEnable();
}
} // end of FileBrowserLocation

I was trying to complicate it too much.

Thanks again for replying!
 
Thanks for replying so quickly but I solved the issue.

very simply, I did a Method call of the superclass...

private class FileBrowserLocation extends FileBrowser
{
public void actionPerformed(ActionEvent pEvent) {
>> super.actionPerformed(pEvent); // Method call of the superclass
locationEnable();
}
} // end of FileBrowserLocation

I was trying to complicate it too much.

Thanks again for replying!

I really need to read the books...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top