views:

2326

answers:

8

Eclipse is a really great editor, which I prefer to use, but the GUI design tools for Eclipse are lacking. On the other hand, NetBeans works really well for GUI design.

Are there any tips, tricks or pitfalls for using NetBeans for GUI design and Eclipse for everything else on the same project?

EDIT: I tried Maven, and it does not seem to work (too complex for my needs).

+5  A: 

MyEclipse offers an integration of the Netbeans GUI editor (Matisse) with Eclipse.

See http://www.myeclipseide.com/module-htmlpages-display-pid-5.html

Tom
Is there a way to use that plugin without MyEclipse? I took a quick look and didn't see anything.
Thomas Owens
Thomas, MyEclipse adds stuff to give their commercial offering value, hence no plugin without myEclipse.
Thorbjørn Ravn Andersen
A: 

Define your project dependencies with Maven, and use it to generate project configuration files for both Netbeans and Eclipse.

Try to keep separate classes directories for Eclipse and Netbeans, since Eclipse doesn't like it when external tools touch its classes.

Tom
A: 

A few gotchas:

  • If you try to use both without any plugins/integration, you must be careful not to edit the regions marked "DO NOT EDIT" as Netbeans will overwrite code in those sections quite frequently.
  • You should use the "Customize..." command to add custom init code for components.
  • Adding/creating new components on a form using Java code will not be reflected in the GUI editor.
  • Developers have to be discouraged from going into the code and adding swing customizations, effectively bypassing the GUI editor.

Another tip is that you can create Java Beans using Eclipse and drag-and-drop them into the Matisse editor. This allows you to create a custom GUI component or a non-GUI component (models, listeners, etc) and add it to a Matisse form. With listeners and models, you can specify a component to use an instance of your custom listener/model instead of the default behavior. You can also drag-and-drop in custom GUI components and manipulate them like any other GUI widget.

James Schek
+2  A: 

Echoing @Tom I'd use an external build tool (Maven 2 would be my pick). I've done this on projects before and as long as you don't walk all over Eclipse's .Xxxx files and folders you'll be fine. Then you get the full power of Netbeans (which integrates with Maven 2 really nicely) or Eclipse and also have the added value of an external build which can also be run by your CI tool. Everybody wins!

Andrew Harmel-Law
I have tried maven, and it is a pain in the butt.
Milhous
+1  A: 

Cloud Garden makes a GUI editor called Jigloo that is quite nice if you are into that sort of thing (and the price is very, very reasonable). If that's all that's missing for you from Eclipse, I'd recommend that you take a look. Netbeans does a ton of stuff with source code that you aren't allowed to edit, etc...

One other thing that I will mention: I have used GUI editors like Matisse and Jigloo for super rapid prototyping. However, within 3 or 4 iterations, I always find myself dropping back to hand coding the layouts. I also find that when I'm doing rapid prototyping, I am almost always more productive when I change the layout manager to absolute and just place components. Once the design starts the gel, implementing the design by hand coding using a good layout manager (I strongly recommend MiG Layout) is pretty easy, and gives much better results.

I know that dragging and dropping a GUI layout is really enticing - but MiG Layout is incredibly productive for hand wiring GUIs, and I suspect that almost any developer will be more productive within a week going down that path.

Kevin Day
+1  A: 

import project in netbeans create gui and then again open the project in eclipse

it works with no error

+3  A: 

Create your GUI with Netbeans. copy a Eclipse .project file (like below) into the project folder change the MyProjectName. Open Eclipse and import the project into your workspace, so you can open the projekt from your Eclipse workspace with Netbeans. Now you able to use Netbeans to create and change the GUI and editing the code with Eclipse.

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
 <name>MyProject</name>
 <comment></comment>
 <projects>
 </projects>
 <buildSpec>
  <buildCommand>
   <name>org.eclipse.jdt.core.javabuilder</name>
   <arguments>
   </arguments>
  </buildCommand>
 </buildSpec>
 <natures>
  <nature>org.eclipse.jdt.core.javanature</nature>
 </natures>
</projectDescription>
A: 

For me using linked source folders works quite well.

I build the GUIs in independent NetBeans projects - if they need some simple classes or interfaces, I use the "link source" (right click on project in NetBeans, choose properties), to include these in the NetBeans project.

My main projects are in eclipse. Here I again use the link source feature to link to the NetBeans project (right click on project in eclipse, select "build path", then "link source").

EDIT (Thx to Milhous :) ): in both projects in eclipse and NetBeans further all required JAR files need to be added to the build path (also the libraries added by NetBeans: eg beansbinding-1.2.1.jar, appframework-1.0.3.jar swing-worker-1.1.jar, ...)

Now the GUI classes can be reused in eclipse. Also leads to need to have GUI and logic classes quite decoupled, which can be nothing bad.

mxro
You have to find the location of the jar files, and add them to the classpath in eclipse.
Milhous