views:

34

answers:

4

I learnt swing basics and event handling basics from head first java... Then i read a few tutorials on swing app development using netbeans...

and i loved it as i don't have to care about layouts and stuff...

But i read in one of the forums, that i should learn swings properly rather than using netbeans directly...

This confused me a bit....

Please suggest the best way to master development of swing apps....

thanks in advance

A: 

It depends on what you see as your goal. There is no "perfect" approach to get comfortable using Java and swing, it always depends on what you want the outcome to be like.

Most enterprises depend on stability and speed, programmers need to write code fast and stable. If you write complex interfaces by hand it gets ugly when it comes to speed and precision at the same time. You can never write better code in terms of "it is working" then the netbeans gui builder can. Also, no one will probably have a look at your code once the application is up and running.

If you want to get to know swing only for the purpose of knowing it with no deeper intention what so ever, I'd recommend learning it by heart without netbeans as you'll probably familiarize yourself with most of it's functionality quicker then the other way around.

On one hand, if I want to learn something, I want to learn it from scratch, so I would probably go with writing swing-code myself and in the end using netbeans to generate it when I am fully able to comprehend what is generated. On the other hand, if I need to write applications quick and am not paid to go into any details, I'd simply use netbeans.

Robin
A: 

I think you have answered yourself... you want to master development of swing apps... everything that you do by autogenerating without knowing why or how is not mastering in my opinion ;)

Zavael
A: 

If you want to be master, then you should at least know how to do it with your bare hands. Moreover, it will also help you if you will use other gui toolkits (main principles of gui toolkits are more or less the same, imho).

foret
+2  A: 

Well, I see I'm going to run counter to the majority here ;-)

Hand coding GUIs is a pain in the ass. Anything that makes that task easier is a good thing in my book. When you're just starting, having a generated GUI lets you get up and running faster.

GUI builders handle the really repetitive work and prevent you from doing the most common dumb things. The downside is that same approach will also prevent you from doing the really clever things. Eventually, you will encounter something that you cannot do through the GUI builder and you will need to poke into the code. So, you can't treat code generators like black boxes where you don't need to know what magic happens inside. At minimum, you need white boxes. Let the GUI builder do its magic, but understand that magic and its limitations.

Practice by generating a very simple GUI. Walk through the code and understand what it does. Make a change through the builder and see how the generated code changes. Try changing the code yourself to confirm you understanding is correct. *

If you don't understand something, hit the JavaDocs, the Swing Trail, or browse through the Java2S Swing Tutorials.

If you're still stuck try the kind folks at Java Ranch, or here on StackOverflow.

* Netbeans puts the generated code in guarded blocks and will not let you edit them directly. However, you can open the file in another editor to test a change. Also, you can do quite a lot to influence the code generation using the code tab in the properties window.

Devon_C_Miller
Thank you very much Devon..I liked your answer...
Shahensha