Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 729
tgogos Avatar asked Jul 29 '12 16:07

tgogos


People also ask

Can you build a GUI with Eclipse?

eclipse is an editor. you write code, and THAT code would create your gui. The Eclipse Rich Client Platform (RCP) allows you to build a GUI using Eclipse as the framework. Eclipse is also an integrated development environment (IDE) that allows you to write code in Java and other languages to construct a GUI.

Does Eclipse support Java Swing?

You can use Swing components inside a Eclipse plugin.


1 Answers

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.

like image 165
f4lco Avatar answered Sep 18 '22 14:09

f4lco