Write gui programatically, or using an advanced gui editor (Java Swing)?

Yes, the NetBeans GUI builder is one of the finest around. I was particularly impressed with how well it handles the infamous GridBagLayout.

Yes, the NetBeans GUI builder is one of the finest around. I was particularly impressed with how well it handles the infamous GridBagLayout. Borland JBuilder was in my experience the very best round-trip GUI editor; if I remember correctly, it produced code without "locked areas" and would usually continue to work gracefully with GUI code that you had manually tweaked.

Still, I have yet to find a Java Swing GUI editor that doesn't occasionally choke on a complex layout, i.e. Enter a state where further editing is no longer feasible and/or requires some backing up or fixing. Thus, I prefer to hand-code all my GUIs.

Heinz Kabutz of JavaSpecialists tells me his GUI editor is vim. However, I admit that most of my other friends and colleagues consider me crazy for doing this.

Thanks for your answer. Much appreciated. – Andrei Ciobanu Mar 15 '10 at 22:36 1 I actually like hand-coding GUI's in Swing, but maybe I'm just crazy?

I've done this for moderately complex programs, and it worked out fairly well. – Tikhon Jelvis Mar 15 '10 at 22:45 I always hand-code my GUIs. But I try to avoid LayoutManagers that require a lot of boilerplate code (eg GridBagLayout).

I much prefer "smart" layouts such as DesignGridLayout or libraries that wrap GBL to give it a better API (painless-gridbag). These make it easy to hand code GUIs and still make it possible to maintain them afterward. – jfpoilpret Mar 15 '10 at 23:36 Interesting what you said about JBuilder's round-trip.

When I used it I found that it always failed to adapt to my manual code tweaks and this is one of the things that turned me off of gui builders. However, this was long ago and it sounds like it might be better now. – Marshall Alsup Mar 16 '10 at 19:29 @Marshall Alsup: My guess is that we just had different coding/tweaking styles, and I coincidentally tended toward JBuilder friendly changes and you did not.

– Carl Smotricz Mar 16 '10 at 19:39.

With the newest versions of Netbeans, you can share projects between Eclipse and Netbeans. So, if you don't like coding in it much, you can use it just for the GUI features and then edit the code in Eclipse. Make sure you create your project in Eclipse first, and then use the importer.

They will share the same directory. netbeans.org/kb/docs/java/import-eclipse....

1 Cool, I think this is useful info, +1! – Carl Smotricz Mar 16 '10 at 19:39 Wow, that is cool! Thanks for the info.

– Marshall Alsup Mar 16 '10 at 21:56.

I have always prefered to write my Swing UIs by hand. I've tried Netbeans but I just didn't trust it to do the right thing for a complex UI (although it was quite awesome for a small simple UI). I think a lot of us fear writing Swing Layouts by hand because of GridBagLayout.

Its not that hard once you've used it a few times. I used to swear by it. However, recently I've moved to a new job and their existing code uses TableLayout instead.

Its much simpler and seems just as powerful to me. I've grown to prefer it to GBL. I think you should consider it if you're new to writing Swing.

I'm sorry but I'm not sure about your question of scale. Best of luck! Funny side story about JBuilder.My friend who taught me swing taught me to code it by hand, and he always had me put the layout code in a jbinit() method.

For several weeks I assumed this was just some code style he used. It was only later I learned that it was an auto-generated method of JBuilder at the time. I didn't need to be using it at all.

I was such a n00b :).

Interesting, I'd never heard about TableLayout before. Another "newfangled" layout manager I can recommend is GroupLayout, it's even more versatile than GridBagLayout yet (IMO) simpler to work with. Where I used to nest components to create complex layouts, I can now nest GroupLayouts in a single component.

Finally, MiGLayout is 3rd party but also has a great ratio of ease-of-use to power; preferred by many and a candidate for the Sun JDK. – Carl Smotricz Mar 16 '10 at 19:45 I will give TL a try – Kim Jong Woo Nov 30 '11 at 20:40.

I recently (4 weeks ago) switched from eclipse/SWT to Netbeans 6.8/Swing (after being fed up with some plugin licensing issues in Eclipse). I came in cold not being familiar with either Netbeans or Swing and was quickly impressed. I managed to convert 4 years of SWT experience into Swing experience very quickly and now consider Netbeans the best Java GUI editor.

Whilst some parts of autogenerated code are read only - this is a good thing. Eclipse allows you to edit the autogenerated code and this can cause major headaches with layouts, alignment and so on if you make a mistake. Netbeans allows you can create custom 'event handling methods' (my terminology only) which gets the autogenerated block to invoke your methodd at particular points in the lifecycle so you can access the 'read only' code whenever you need to.So stick with NetBeans, its the best Java Swing environment there is.

You do NOT want to code by hand, for any reasonably sized app. Let the GUI do most of the plumbing for you (especially when using the the different layouts - this alone will make you tear your hair out), so you can focus on the service/business logic.

I've used netbeans, WindowsBuilder plugin in eclipse, and resorted to just writing Swing code by hand. I definitely appreciate the fact that netbeans and windows builder write the swing code for you, but I like knowing every inch of the code in my project and know where to go when I want more complex and add details. Having said that I think netbeans is worth a try too but I was a bit nervous of going through the generated java code, whereas if I had written them from scratch, I don't have this worry.

WindowsBuilder plugin for eclipse totally screwed up my eclipse, the content assist became permanently slow, even after removing it. While the Swing Data Binding framework has some learning curve (at least for me because I didn't know it was the same as JFace Data Binding Framework), I had trouble finding documentation for it, and was referred to the JFace wiki.... Overall, you are right, I think you do get to think more about your application logic than writing plumbing code spent on the gui, but if you write them yourself it just gets faster and faster. I also don't like the fact that I need to be dependent on a gui editor to create my application.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions