Page 1 of 1

ViewerFromScratch and NetBeans forms

Posted: Sun 7. Aug 2011, 12:52
by gmseed
Hi

I can get the ViewerFromScratch tutorial working at:

http://www3.math.tu-berlin.de/jreality/ ... one_viewer

However, when using an IDE such as NetBeans ui forms are typically used.

If I setup a basic JFrame form with the default FreeDesign ui layout selected and look at the code we have:

public class ViewerFromScratch extends javax.swing.JFrame {

/** Creates new form ViewerFromScratch */
public ViewerFromScratch() {
initComponents();
}
//...

with initComponents() auto-generated by GUIBuilder.

When the application is run the icosahedron is not displayed.

I tracked the problem down to the GUIBuilder applying the default GroupLayout.

If I select a different layout such as BoxLayout:

getContentPane().setLayout(new javax.swing.BoxLayout(getContentPane(), javax.swing.BoxLayout.LINE_AXIS));

then it works. However, careful selection of the layout is required.

Has anyone else experienced this problem and why does it work for BoxLayout and not for other layouts when using ui forms?

Thanks

Graham

Re: ViewerFromScratch and NetBeans forms

Posted: Fri 19. Aug 2011, 21:16
by Andre
This sounds ugly, did you have any other tutorials where happend the same or was it just the viewerFromScratch-example. What Layout was the installed one, was it the GridBag-Layout what we're using a lot for our GUI. Have tried other Layouts like the Flowlayout aswell?