アットウィキロゴ

java 52 52

import javax.media.j3d.*;
import com.sun.j3d.utils.universe.*;
import java.awt.*;
import javax.swing.*;
import com.sun.j3d.utils.geometry.*;
public class ex52
{
public static void main(String[] args)
{
  ex52 test = new ex52();
}
public ex52()
{
  JFrame frame = new JFrame();
  frame.setSize(800,800);
  frame.setTitle("ex52");
  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(50,50,550,500);
  cp.add(canvas);
  SimpleUniverse universe = new SimpleUniverse(canvas);
  frame.setVisible(true);
  BranchGroup group1 = new BranchGroup();
  Sphere sphere = new Sphere(0.5f);
  group1.addChild(sphere);
  universe.addBranchGraph(group1);
}
}
最終更新:2010年01月06日 15:06