アットウィキロゴ

pr00511

import javax.media.j3d.*;
import com.sun.j3d.utils.universe.*;
import com.sun.j3d.utils.geometry.*;
import java.awt.*;
import javax.swing.*;

public class pro0511
{

public static void main(String[] args)
{
 pro0511 test = new pro0511();
}


public pro0511()
{

 JFrame frame = [[new]] JFrame();
 frame.setSize(250,250);
 frame.setTitle("Object_test");
 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 JPanel cp = new JPanel();
 cp.setLayout(null);
 frame.add(cp);

 GraphicsConfiguration g_config = SimpleUniverse.getPreferredConfiguration();
 Canvas3D canvas = new Canvas3D(g_config);
 [[canvas]].setBounds(0,0,250,250);
 cp.add(canvas);

 SimpleUniverse universe = new SimpleUniverse(canvas);
 frame.setVisible(true);

 //ブランチ・グループを生成
 BranchGroup group1 = new BranchGroup();
 
 //Sphereを生成(半径は0.5)
 Sphere sphere = new Sphere(0.5f);

 //sphereをブランチ・グループへ登録
 group1.addChild(sphere);

 //ブランチ・グループを仮想空間へ登録
 universe.addBranchGraph(group1);


}

}
最終更新:2010年09月20日 19:03