Skip to main content

about the new JCanvas3D

6 replies [Last post]
little_brain
Offline
Joined: 2007-01-01

Hello all,
Sometime ago i created a material editor where i show some canvas3D for preview of the material. Little bit similar to studio3D. Everything work fine, but when you scroll the material list everything go behind the panel as suppose excepted the Canvas3D who wont and go over other panel. For moment i use limited number of canvas3d for preview, else the canvas go over other panel. Now i tried the JCanvas3D cause of the way to be able to set as lightweight component, but with the new JCanvas3D, if i put on my simpleuniverse it come back a major component and bug. Soo i am getting minor in major error. Can the Canvas3D continue to work has he did before but go behind other component like lightweight item?

sorry about my english, not alway fine =P

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
stylertim
Offline
Joined: 2006-05-04

could you post a code snippet with the relevant code which leads to the JCanvas3D errors?

little_brain
Offline
Joined: 2007-01-01

I removed most of button and other thing in the code. The problem is in the way i load the new JCanvas.
I receive the error java.lang.UnsupportedClassVersionError: com/sun/j3d/exp/swing/JCanvas3D (Unsupported major.minor version 49.0)

public MaterialEditor(String title) {

for(int i =0; i < MAX_CANVAS; i++) {
canvas_list[i] = new JCanvas3D(device)
canvas_list[i].setSize(new Dimension(75,75));
canvas_list[i].addFocusListener(this);
panel_list[i] = new JPanel();

panel_list[i].setLayout(new FlowLayout(FlowLayout.LEFT));
panel_list[i].setBackgroun(Color.LIGHT_GRAY);

//i init the view of the canvas here with the basic form
setDefaultView(i,canvas_list[i]);

panel_list[i].add(canvas_list[i]);
panel_canvas.add(panel_list[i]);
}
adjustPanelColoring(canvas_list[0]);

getContentPane().add(panel_n,BorderLayout.NORTH);
getContentPane().add(panel_canvas,BorderLayout.CENTER);
getContentPane().add(intern,BorderLayout.EAST);
}
public void setDefaultView(int index,JCanvas3D canvas) {
BranchGroup objBG = new BranchGroup();
objBG.setCapability(BranchGroup.ALLOW_DETACH);
objBG.setCapability(BranchGroup.ALLOW_CHILDREN_READ);
objBG.setCapability(BranchGroup.ALLOW_CHILDREN_WRITE);
objBG.setCapability(BranchGroup.ALLOW_CHILDREN_EXTEND);

obj_list[index] = new BranchGroup();
obj_list[index].setCapability(BranchGroup.ALLOW_DETACH);
obj_list[index].setCapability(BranchGroup.ALLOW_CHILDREN_READ);
obj_list[index].setCapability(BranchGroup.ALLOW_CHILDREN_WRITE);
obj_list[index].setCapability(BranchGroup.ALLOW_CHILDREN_EXTEND);

//think my problem come when i attach here.
simpleU[index] = new SimpleUniverse(canvas.getOffscreenCanvas3D());
simpleU[index].getViewingPlatform().setNominalViewingTransform();

switch(form_type[index]) {
case FORM_SPHERE:
texEffect[index] = new TextureEffect();
Sphere sphere = new Sphere(0.8f,Sphere.GENERATE_NORMALS,32,texEffect[index].getDecal());
sphere.setCapability(Sphere.ENABLE_APPEARANCE_MODIFY);
objBG.addChild(sphere);
break;
case FORM_BOX:
texEffect[index] = new TextureEffect();
Box box = new Box(0.8f,0.8f,0.8f,texEffect[index].getDecal());
box.setCapability(Box.ENABLE_APPEARANCE_MODIFY);
objBG.addChild(box);
break;
case FORM_CYLINDER:
texEffect[index] = new TextureEffect();
Cylinder cyl = new Cylinder(0.8f,0.8f,texEffect[index].getDecal());
cyl.setCapability(Cylinder.ENABLE_APPEARANCE_MODIFY);
objBG.addChild(cyl);
break;
}
obj_list[index].addChild(objBG);

simpleU[index].addBranchGraph(createLight());
simpleU[index].addBranchGraph(obj_list[index]);

}

Message was edited by: little_brain

stylertim
Offline
Joined: 2006-05-04

Hmm, not that helpful. Why donÄt you send me the source code via email?

I've never seen this error before but there has to be a solution.

little_brain
Offline
Joined: 2007-01-01

I think it come from the version i compile with, but i am not sure. Do i have to compile from 1.5 or 1.4.10?

Message was edited by: little_brain

stylertim
Offline
Joined: 2006-05-04

You have to compile using the 1.5.0 libraries since JCanvas3D and the package com.sun.j3d.exp.swing was introduced with one of the beta builds if i remember correctly. Further improvements will be built in the 1.5.1 bug fix release which is scheduled for May 2007, daily builds are already available.

That would explain why i didn't stumble over this erro so far... ;)

Message was edited by: stylertim

kcr
Offline
Joined: 2004-03-17

Just a reminder that Java 3D 1.5.0 requires Java SE 5 (JDK 1.5) to compile and run. See the release notes at:

https://j3d-core.dev.java.net/j3d1_5_0/RELEASE-NOTES.html

-- Kevin