We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Help with saveAsMenuItem.addActionListener

Drop_of_Rain
Drop_of_Rain asked
on
Medium Priority
328 Views
Last Modified: 2010-08-05
Someone here said it would be better to use the type of code below, other then ActionCommand:

saveAsMenuItem.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(ActionEvent e) {
        saveAsMenuItem_actionPerformed(e);
      }
    });

Could someone give me an example of how this would be used from a menu through to a SaveAs JFileChooser.
Comment
Watch Question

Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Author

Commented:
I have an accessory named AudioAccessory to add to the file chooser, how would that be done here, would it just be added at:

y.setDialogTitle("Save . . .");
AudioAccessory aa = new AudioAccessory();
y.setAccessory(aa);
y.setFileSelectionMode(JFileChooser.FILES_ONLY);
y.setCurrentDirectory(new File("C:/"));
Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010

Commented:
yes
Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010

Commented:
you would only need to do that initialisation of the chooser once though, not every time you wanted to use it.

Commented:
> I have an accessory named AudioAccessory to add to the file chooser

Yes, thats correct :)

Author

Commented:
I doubled the points to make it fair on you guys.

Thanks everyone for all the support.
Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010

Commented:

Commented:
http://www.freewebs.com/cube-j

Always there to help . . .
Friend : Javatm
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.