I’ve been doing quite a bit of Java over the last fortnight. It’s much easier with eclipse of course, but it’s still pretty verbose. But I dunno, maybe it’s just me, a whingy old Perl coder. But then again, look what I’ve just found in the Java Cookbook:
public class Ls {
public static void main(String argh_my_aching_fingers[]) {
// ...
}
}
Glad to know I’m not the only one.
@Marc: I’ve just added the formatting back in for you.
I have to be honest, when it comes to GUI programming I’ve only seen two systems that look at all “clean” (bear in mind I’m emphatically not a GUI programmer).
In general, I’ve become quite immune to the verbosity of Java since I first wrote this post. Heck, if I can learn to like maven…
My last post now, I apologise for the spiel! But you see, it got to the point where I couldn’t even figure out that the setAccelerator method is called with an instance of the KeyStroke class (I think), supplied with the constant KeyEvent.VK_S representing the ‘S’ key… Ad nauseum! There must be an easier, cleaner way to do it whilst still maintaining accessibility, portability and design standards… From my brief looks at the GTK, Qt/KDE and Tk libraries, it seems that it is possible to some degree – although I couldn’t be sure about that!
Of course, this layout messed up any formatting it might’ve had, how much clearer can you make a method call that contains another method call that eventually drills down even further to return a value from an instance of the Toolkit class… It’s making me dizzy; just count the parentheses!
And the code’s from here.
@Marc
Sorry I meant “psvm” of course…
I hear you! I’m so glad there’s a macro for such things in NetBeans, it expands it for you so you only have to type “pvsm”. I wonder if you’ve tried that one instead of Eclipse, bearing in mind it’s 2009 now and not 2006… It’s the first Java IDE I’m really trying to learn with, and it’s a bit confusing to separate all the IDE fluff that comes with it.
This next one might make you laugh too. I don’t even own an Apple device of any sort, but I stumbled across this example of how to add a shortcut key to a menu item in Swing:
Looks like Swing takes the biscuit!