March 30, 2006Jaxx... oh my
I couldn't resist reading an article opening with "I want to break free from the GridBagLayout: introducing Jaxx". I should have known better... Here is the value proposition of Jaxx: you describe your Swing applications in XML and you code your Java logic inside these XML files. Yup. I have two problems with this:
I understand the value of describing interfaces in an XML file, but at least, please make sure that I can keep writing my logic in good old Java files. As for GridBagLayout, do yourself a favor and forget everything you ever learned about it. Either use JGoodies or SWT's fantastic GridLayout. Posted by cedric at March 30, 2006 09:00 AMComments
Or better yet, use a GUI builder :) Posted by: Romain Guy at March 30, 2006 11:30 AMI must admit that sometimes I feel like I'm not giving all technologies a fair coverage when I blog... but afterall I'm no journalist trying to be fair to all (assuming that's what journalists do). Reading your post which fails to mention javax.swing.GroupLayout has me feel much better Cédric. Thanks. :-) Posted by: Alexis MP at March 30, 2006 11:33 AMCedric, I think the main attraction of JAXX is use of CSS. I see this as a huge innovation. Maybe XML isn't the right application of CSS, but I think using CSS to design rich applications is an awesome idea. Posted by: Keith Lea at March 30, 2006 04:24 PMSurely you gest? Use an html markup construct to describe how to render a GUI? I can't tell you how many endless miles of torturous swing code I've written using GridBagF-out. I don't know why rendering hints weren't added in in the beggining. Maybe the sun engineers were too busy mentally masturbating each other to check out what more of the tried and true GUI toolkits were doing. (like Qt, which I love...even though c++ is dying on us :) ) Posted by: Jesse Kuhnert at March 30, 2006 07:21 PMI think it's a bad idea that will unfortunately be popular, for the same reasons that JSP's, XOM, and embedding JavaScript into HTML are popular. The people who want this sort of thing don't care about easy testing or refactoring. It's sure to keep IDE developers employed for years to come. Posted by: Brian Slesinsky at March 30, 2006 10:20 PM锡达蜂窝 I'm not going to comment on replacing Swing with HTML/CSS. Both have their place. If you use Swing too little to figure out the "art" of GridBagLayout and you don't want to use one of the open source layouts, you can just figure out how to nest the simpler layouts to make it work. Second, quit worrying about the "exact" layout of the thing. Even if you are tied to Windows, in 3 years the new screen resolutions in common use will make todays eye candy into a pain in the eye unless you plan for inexact placement. That's assuming you don't want your Swing app to run today on some Linux windowing system or Mac where the fonts are all different. (And we don't want to think about what might change in the next version of Java.) By "nesting" above I mean you put panels inside panels. The outer panel might be using a grid layout with one column while the inner panel uses a box layout that's horizontal. If you think about it and group the components intelligently, you can do almost anything in a way that scales well and accounts for the fickleness of font sizes. A "rule" for making good layouts is to never make anything a fixed size in pixels other than the margins. Let boxes be their natural size. Maybe give the user a choice of font size and make all the fonts with multiples of that size. Otherwise just let fonts be whatever size they want. That allows adjusting to different display devices. Goodness. I never quite understand why the nesting nature of XML generates such attention for UI creation. Here's how I build UI in Java...this is whole thing. Reflection is used to create nested component structures and wire up listeners. Annotations guide the process. Small inferences eliminate the need for much boilterplate. If you think this is dense, you should see the Scala code :)
p.s. what you're missing there is the indentation, of course :) put it in Eclipse and format it. Posted by: Ross Judson at March 31, 2006 07:49 PMI think you meant GridLayout and not TableLayout for SWT. TableLayout is just for Tables. Posted by: Brad Reynolds at April 4, 2006 06:06 AMAh, the joys of code generation. Sounds like this is what Jaxx is doing. I've learned through bitter experience that you *never* put Java code anywhere except in a .java file. Oh My. What a world of pain... Posted by: Richard Rodger at April 6, 2006 04:09 AMThanks Posted by: oyun at December 28, 2007 09:39 AMPost a comment
|