,,,
JAVA-
1.
2.
2.1. Java 2D
2.2. Java 3D
2.3. 3D Paint
3.
, Java. Java AWT Java . , Java 2D Java 3D, , , , .
. , Java Java 2D Java 3D.
3D Paint.
. . , . Web-, , .
, .
Java 2D Java 3D. 3D Paint.
1.
:
1. Java jdk1.6.0.
2. Java Java3D 1.5.1.
3. , Java - NetBeans IDE 6.0.
2.
2.1. Java 2D
, , , . , , , , , : , , , .
Java , Java . , . JDK : , . AWT . Java , , .
Java, peer-, AWT (Abstract Window Toolkit). , Java peer-, (peer-to-peer) , .
JDK 1.1 AWT . , Java peer-. "" (lightweight) , peer-, "" (heavy).
"" Java, Swing. AWT, Swing , , AWT.
Swing JDK 1.1. Java 2 SDK , "100% Pure Java", AWT.
Java 2 AWT , , Java 2D, , DnD (Drag and Drop).
, Java 2 / Input Method Framework /, , Accessibility.
Java 2: AWT, Swing, Java 2D, DnD, Input Method Framework Accessibility Java, JFC (Java Foundation Classes).
() (component) . , -, . , , . , , , , , . . , , , , .
AWT Component , component. Component . AWT.
(Container). "", . , Java Container . Jomponent Swing.
Component , Container add ().
Container , Component. , , - , .
AWT
AWT : Button, Canvas, Checkbox, Choice, Container, Label, List, Scrollbar, TextArea, TextField, Menubar, Menu, PopupMenu, Menultem, CheckboxMenuItem. , Canvas "" , Component "" ( Swing).
Panel, ScrollPane, Window, Frame, Dialog, FileDialog. "" Panel, "" Container.
, , , , .
, . . Component, (graphics context). . Color, Font.
, (0, 0) , , . .
Graphics Graphics2D, Java 2. , . Graphics Graphics2D.
Java , Graphics getGraphics() Component paint() update().
Graphics
Graphics:
|
|
|
|
setColor (Color newColor) | |
getColor () | |
Color(int red, int green, int blue) | , red, green blue . RGB. 0 ( ) 255 ( ). |
Color(float red, float green, float blue) | 0.0 ( ) 1.0 ( ) |
Color(int rgb) | . 1623 , 815 , 07 . |
|
|
drawLine(int xl, int yl, int 2, int y2) | (xl, yl) (2, 2). |
drawRect(int x, int , int width, int height) | , , (, ), width height |
drawOval(int x, int , int width, int height) | , , . width = height, |
drawArc(int x, int , int width, int height, int startAngle, int arc) | , , . |
drawRoundRect (int x, int , int width, int height, int arcWidth, int arcHeight) | . , arcWidth arcHeight, |
drawPolyline(int[] xPoints, int[] yPoints, int nPoints) | (xPoints[i], ypoints[i]) nPoints |
|
|
drawstring (String s, int x, int y) | s |
drawBytes(byte[] b, int offset, int length, int x, int ) | length , offset |
drawChars(chart] ch, int offset, int length, int x, int ) | length ch, offset |
|
|
setFont(Font newFont) | |
getFont () | |
Font (String name, int style, int size) | name, style size . |
1. Graphics
Java 2D
Java 2D, , Graphics2D java.awt, .
- , Graphics (User Space), (Device Space): , . Graphics2D (transform) .
- "", , , / /. AffineTransform. setTransform(). " " transform translate concatenate().
- , , .
- : , , ., shape java.awt. draw, , shape. fill, , shape.
- (stroke) (). stroke. Basicstroke . :
Ø (width) ( ) ;
Ø (end cap) CAP_ROUND, CAP_SQUARE ( ), CAP_BUTT;
Ø (line joins) JOIN_ROOND, JOIN_BEVEL, JOIN_MITER ( );
Ø (dash) -, , , .
- Paint. . color (solid) , GradientPaint (gradient) , , Texturepaint (pattern fill).
- , . . , shape, draw . , .
- , , , , , , . , . , . TextAttribute.
- (rendering) (hints), RenderingHints.
Java 2D , .
2.2. Java 3D
. x, y z. , , , . . , , , , .
, . . 70- API CORE Siggraph 80- OpenGL SGI, , Microsoft DirectSD Java3D.
, . Java 3D , , . Java 3D API . Java 3D , , . Java, Java 3D, , , . Java 3D .
Sun Microsystems Java 3D API, : , , . Java 3D API. API Java 3D:
,
,
( ),
,
,
,
Web-,
.
Java 3D , :
. Java 3D , , (, ) ( ).
. Java 3D , . , .
. Java 3D . Java 3D , , , SDStudio , VRML LightwaveSD.
. Java 3D . Java 3D , .
. Java 3D SD-.
. Java 3D .
Java 3D.
, Java 3D, . , . Java 3D VirtualUniverse. VirtualUniverse , . Java 3D , . VirtualUniverse . . . Locale -. Java 3D -: - - . - , , , , . - , , , . .
SceneGraphObject Java 3D -. SceneGraphObject Group, , . Group ( Group), ( Leaf) - ( NodeComponents). - Leaf , - - . NodeComponent Group Leaf, .
Group, Leaf Node-Component:
|
|
|
Group Java 3D |
||
BranchGroup | ( Node) , Locale | |
Switch | , , | |
TransformGroup | (, , ) | |
Leaf |
||
Behavior |
(, ), , (, ) |
|
Light | Java 3D | |
Shape3D | ||
ViewPlatform | ||
NodeComponent |
||
Appearance | Shape3D, | |
Material | (, . | |
2. Group, Leaf Node-Component
2.3. 3D Paint
3D Paint.
Java .
Java Java 2D Java 3D.
( ); : , , , , , , ; , .
, : , , , , , . , .
, NetBeans IDE 6.0, ( 1). , . (, ) SWING AWT.
1. 3D Paint
, , . BorderLayout ( ). FreeDesignLayout.
, com.sun.j3d.utils.geometry. geometry : cylinder, box, cube, sphere, cone.
:
Cylinder CylinderObj = new Cylinder(0.7f, 1.4f, ap);
objTrans.addChild(CylinderObj);
0.7f 1.4f ( ).
:
MouseRotate behavior = new MouseRotate(objTrans);
objTrans.addChild(behavior);
behavior.setSchedulingBounds(bounds);
- .
MouseZoom behavior2 = new MouseZoom(objTrans);
objTrans.addChild(behavior2);
behavior2.setSchedulingBounds(bounds);
- ().
orbit = new OrbitBehavior(c, OrbitBehavior.REVERSE_ALL |
OrbitBehavior.STOP_ZOOM);
BoundingSphere bounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0), 100.0);
orbit.setSchedulingBounds(bounds);
viewingPlatform.setViewPlatformBehavior(orbit);
- .
Transform3D yAxis = new Transform3D();
Alpha rotationAlpha = new Alpha(-1, 10);
RotationInterpolator rotator = new RotationInterpolator(rotationAlpha, objTrans, yAxis, 0.0f, (float) Math.PI*-2.0f);
BoundingSphere bounds1 = new BoundingSphere(new Point3d(0.0,0.0,0.0), 100.0);
rotator.setSchedulingBounds(bounds1);
objRoot.addChild(rotator);
- . ( ).
Font3D javax.media.j3d. Font3D , (, , ), . , : , .
. , . ColorChooser javax.swing. . ColorChooser RGB, HSB Swatches.
, - JMenyBar. - 3DPaint JMeny.
3DPaint , javax.swing, , .
Java. Java. , , Java 3D , . , , , Java 3D.
Java. , . Java 2D. , .
Java 3D. Java 3D Java 2D 3D Paint, Java 3D, (, ) .
1. . . , .. , .. - Java, 1 (, JAVABEANS, )
2. - Java
3. James Gosling, Bill Joy, Guy Steele, Gilad Bracha - The Java Language Specification, Second Edition.
4. Tim Lindholm, Frank Yellin - The Java Virtual Machine Specification, Second Edition.
5. ., . - Java
6. www.infocom.uz
7. Java www.java.sun.com
JAVA- 1. 2. 2.1. Java 2D 2.2. Java 3D 2.3. 3D Paint
Copyright (c) 2024 Stud-Baza.ru , , , .