import java.awt.BorderLayout; import java.awt.GraphicsConfiguration; import javax.media.j3d.*; import javax.swing.*; import javax.vecmath.Point3d; import com.sun.j3d.utils.geometry.ColorCube; import com.sun.j3d.utils.universe.SimpleUniverse; //JFrame class inherits the code from the Swing JPanel class. public class SampleCubeRotate3D extends JPanel { //The constructor method public SampleCubeRotate3D() { //Set the layout, this is just a standard thing. setLayout(new BorderLayout());
public static void main(String[] args) { //Set the No Erase Background property to true System.setProperty("sun.awt.noerasebackground", "true"); //Disable the JPopupMenu JPopupMenu.setDefaultLightWeightPopupEnabled(false); //Create an instance for the ToolTipManager ToolTipManager ttm = ToolTipManager.sharedInstance(); //Disable the ToolTipManager ttm.setLightWeightPopupEnabled(false); //Create object instance SampleCubeRotate3D main = new SampleCubeRotate3D(); //Create new JFrame instance JFrame frame = new JFrame("Just Java 3D - Spinning Cube!"); //Set the size of the JFrame frame.setSize(750, 500); //The frame will now hold the main canvas frame.getContentPane().add(main); //Make sure the frame is actually visible frame.setVisible(true); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)