Java – How to use eclipse to build a GUI? (I want to use only swing/awt and no other packages)

eclipseidejavauser interface

I usually write java code using a simple text editor and .bat files to compile and run. I'm not used to IDEs like Eclipse or Netbeans and as a result every GUI I've made so far has been written by hand.

Questions:

  • Can I use eclipse to build a GUI easily (e.g. drag-drop features)?

  • Can this generated code use only the basic java packages (swing, awt) and not any other package provided by the IDE?

I'm saying this because -correct me if I'm wrong- from what I have read so far, I understand that Eclipse and other IDEs use their own packages (to achieve better layouts for example). I would like to avoid this dependency and if possible copy-paste the code generated by Eclipse and then work in the simple way I'm used to.

Thanks in advance.

[edit]
Having tried it for a couple of days, I can now say that WindowsBuilder is exactly what I was looking for. Thank you for all your replies.

Best Answer

Eclipse uses the Standard Widget Toolkit (SWT, not included in JRE by default), Netbeans uses Swing (included).
Since recent Eclipse versions, it includes WindowBuilder to create Swing or SWT via drag'n'drop. WindowBuilder is even bidirectional, so code generation is supported as well as reflecting hand-made changes. It don't know if Netbeans includes this feature, too. In 'New' dialog of Eclipse you find everything you need under the WindowBuilder category.