aspose file tools
The moose likes Swing / AWT / SWT and the fly likes Style for ActionListener Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "Style for ActionListener" Watch "Style for ActionListener" New topic
Author

Style for ActionListener

Garandi Garandi
Ranch Hand

Joined: Jan 07, 2003
Posts: 192
Dear Reader,
Which style is better

OR

In First case you have lots of if statements and in second case you have lots of inner class.
So which style is better and why?
Thank you
Garandi
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

I prefer the second because it is more readable, the result of the button press appears close in the code to the button. The only drawback is that there is a small bit of overhead because more classes have to be loaded. This is really pretty negligible amount, though.


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Garandi Garandi
Ranch Hand

Joined: Jan 07, 2003
Posts: 192
Nate,
I have been enjoing your comments in Javaranch.
Thank you
Garandi
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Style for ActionListener
 
Similar Threads
Anonymous Inner class extends/implements
how do i generate an ActionEvent ?
New to GUI, need help with actionListener and buttons
OO design question for game
What is the common structure for your ActionListeners?