📄 helloworld.htm
字号:
<HTML>
<HEAD>
<!-- Created by mktalk.pl on 5/4/99 at 4:41:12 PM -->
<TITLE>HelloWorld.java</TITLE>
</HEAD>
<BODY
BGCOLOR=#000000
TEXT=#FFFFFF
LINK=#FFFFFF
ALINK=#00FF00
VLINK=#888888
>
<FONT COLOR=#FFFF00 SIZE=+0>
<CENTER>Building 3D content with a scene graph</CENTER></FONT>
<FONT COLOR=#FFFF00 SIZE=+3>
<CENTER><B><I>HelloWorld.java</I></B></CENTER></FONT>
<CENTER><IMG SRC="../images/red.jpg" HEIGHT=2 WIDTH=70% BORDER=0></CENTER>
<P>
<PRE>
<FONT COLOR=#00FF00 SIZE=+1>
import javax.media.j3d.*;
import javax.vecmath.*;
import java.applet.*;
import java.awt.*;
import com.sun.j3d.utils.geometry.*;
import com.sun.j3d.utils.universe.*;
public class HelloWorld
{
public static void main( String[] args ) {
Frame frame = new Frame( );
frame.setSize( 640, 480 );
frame.setLayout( new BorderLayout( ) );
Canvas3D canvas = new Canvas3D( null );
frame.add( "Center", canvas );
SimpleUniverse univ = new SimpleUniverse( canvas );
univ.getViewingPlatform( ).setNominalViewingTransform( );
BranchGroup scene = createSceneGraph( );
scene.compile( );
univ.addBranchGraph( scene );
frame.show( );
}
private static BranchGroup createSceneGraph( )
{
// Make a scene graph branch
BranchGroup branch = new BranchGroup( );
// Make a changeable 3D transform
TransformGroup trans = new TransformGroup( );
trans.setCapability( TransformGroup.ALLOW_TRANSFORM_WRITE );
branch.addChild( trans );
// Make a shape
ColorCube demo = new ColorCube( 0.4 );
trans.addChild( demo );
// Make a behavor to spin the shape
Alpha spinAlpha = new Alpha( -1, 4000 );
RotationInterpolator spinner =
new RotationInterpolator( spinAlpha, trans );
spinner.setSchedulingBounds(
new BoundingSphere( new Point3d( ), 1000.0 ) );
trans.addChild( spinner );
return branch;
}
}
</FONT></PRE>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -