problem about resizing a canvas3d

I created a almost empty JPanel and the JPanel contained a Canvas3D. The funny things is resizing the JPanel only to enlarge the canvas3d, not to reduce it.

I mean when I enlarge the JPanel,the 3D things in the canvas3d and the canvas scale up,but when I resize it back,the3D things in the canvas3d didn't scale back,it appears to only change the viewable area of the v3D universe (no scaling seems to occur).

[423 byte] By [wisea] at [2007-11-26 17:15:50]
# 1
Sounds like a swing problem. Have you tried other content in the JPanel besides a Canvas3D? How are you resizing it? What are the settings for preferred size, etc.?
typicallya at 2007-7-8 23:43:51 > top of Java-index,Security,Cryptography...
# 2
well,I searched forums and found someone get the same issues with me, http://forum.java.sun.com/thread.jspa?forumID=21&threadID=718089I seems a bug of j3d?
wisea at 2007-7-8 23:43:51 > top of Java-index,Security,Cryptography...
# 3

I have a class that extends JPanel and adds the Canvas3D with the following lines, using BorderLayout. It's quite stable, and I'm not having any resizing problems, either by manually resizing the window or programmatically altering the panel size. Using JRE 6 and Java3D 1.4.0...

this.setBorder(BorderFactory.createLineBorder(Color.BLACK));

this.setBackground(Color.BLACK);

this.setLayout(new BorderLayout());

GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();

canvas3D = new Canvas3D(config);

this.add(BorderLayout.CENTER, canvas3D);

typicallya at 2007-7-8 23:43:51 > top of Java-index,Security,Cryptography...
# 4
thank u so muchI am a beginner with Java and use NetBeans IDE 5.5 to layout my application, I notice that the layout model is Free Design not BorderLayout.How can I use your solution?
wisea at 2007-7-8 23:43:51 > top of Java-index,Security,Cryptography...
# 5

I believe you can right-click on the JPanel in the design view, and select the LayoutManager from there. Just select BorderLayout, and add your Canvas3D to it, with the constraint set to CENTER.

Or, in the source view, find the initComponents() method and change the setLayout line to:

setLayout(new java.awt.BorderLayout());

And where your Canvas3D is added, make it look something like:

add(canvas3D, java.awt.BorderLayout.CENTER);

typicallya at 2007-7-8 23:43:51 > top of Java-index,Security,Cryptography...
# 6

I've set it to BorderLayout like below

private void initComponents() {

JPanel = new JPanel();

GraphicsConfiguration config=SimpleUniverse.getPreferredConfiguration();

Canvas3D canvas3d;

canvas3d = new Canvas3D(config);

......

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

JPanel.setLayout(new java.awt.BorderLayout());

new Hello3d(canvas3d);

JPanel.add(canvas3d, java.awt.BorderLayout.CENTER);

......

Hello3d is my sample class, it created a SimpleUniverse and a Spere.

until now, the resizing problem is still there:(

wisea at 2007-7-8 23:43:51 > top of Java-index,Security,Cryptography...