50146
|
1 |
The classes for the Java2D(TM) demo are contained in the J2Ddemo.jar file.
|
|
2 |
To run the J2D demo:
|
|
3 |
|
|
4 |
% java -jar J2Ddemo.jar
|
|
5 |
|
|
6 |
-----------------------------------------------------------------------
|
|
7 |
Introduction
|
|
8 |
-----------------------------------------------------------------------
|
|
9 |
|
|
10 |
This Java2D demo consists of a set of demos housed in one GUI
|
|
11 |
framework that uses a JTabbedPane. You can access different groups of
|
|
12 |
demos by clicking the tabs at the top of the pane. There are demo
|
|
13 |
groups for Arcs_Curves, Clipping, Colors, Composite, Fonts, Images,
|
|
14 |
Lines, Mix, Paint, Paths and Transforms. On the right-hand side of the
|
|
15 |
pane, the GUI framework features individual and global controls for
|
|
16 |
changing graphics attributes. There's also a memory-usage monitor, and
|
|
17 |
a monitor for tracking the performance, in frames per second, of
|
|
18 |
animation demos.
|
|
19 |
|
|
20 |
|
|
21 |
-----------------------------------------------------------------------
|
|
22 |
Tips on usage
|
|
23 |
-----------------------------------------------------------------------
|
|
24 |
|
|
25 |
Click on one of the tabs at the top of the pane to select a demo group.
|
|
26 |
When you select a group, a set of surfaces is displayed, each of which
|
|
27 |
contains one of the group's demos. At the bottom of each surface is
|
|
28 |
a set of tools for controlling the demo. The tools can be displayed
|
|
29 |
by selecting the Tools checkbox in the Global Controls panel or
|
|
30 |
by clicking on the slim strip of gray bumps at the bottom of the demo
|
|
31 |
panel.
|
|
32 |
|
|
33 |
If you click on a demo surface, that demo is laid out by itself. A
|
|
34 |
new icon button will appear in the demo's tools toolbar one that enables
|
|
35 |
you to create new instances of that demo's surface.
|
|
36 |
|
|
37 |
To run the demo continuously without user interaction, select the
|
|
38 |
Run Window item in the Options menu and press the run button in the
|
|
39 |
new window that's displayed. To do this from the command line:
|
|
40 |
|
|
41 |
java -jar J2Ddemo.jar -runs=10
|
|
42 |
|
|
43 |
To view all the command line options for customizing demo runs:
|
|
44 |
|
|
45 |
java -jar J2Ddemo.jar -help
|
|
46 |
|
|
47 |
You can run the demos in stand-alone mode by issuing a command like this
|
|
48 |
|
|
49 |
java -cp J2Ddemo.jar java2d.demos.Clipping.ClipAnim
|
|
50 |
|
|
51 |
You can run the demos in groups by issuing a command like this
|
|
52 |
|
|
53 |
java -cp J2Ddemo.jar java2d.DemoGroup Clipping
|
|
54 |
|
|
55 |
To increase or decrease the Memory Monitor sampling rate click on the
|
|
56 |
Memory Monitor's title border, a panel with a TextField will appear.
|
|
57 |
|
|
58 |
The J2Ddemo Intro (the 'J2D demo' tab) contains a scene table, click in
|
|
59 |
the gray border and a table will appear.
|
|
60 |
|
|
61 |
Animated demos have a slider to control the animation rate. Bring up
|
|
62 |
the animated demo toolbar, then click in the gray area of the toolbar
|
|
63 |
panel, the toolbar goes away and the slider appears.
|
|
64 |
|
|
65 |
Demos that have Custom Controls can have their Custom Control Thread
|
|
66 |
activated and stopped by clicking in the gray area of the demos Custom
|
|
67 |
Control panel.
|
|
68 |
|
|
69 |
-----------------------------------------------------------------------
|
|
70 |
NOTE about demo surfaces
|
|
71 |
-----------------------------------------------------------------------
|
|
72 |
|
|
73 |
The demo groups are in separate packages with their class files stored
|
|
74 |
in directories named according to the demo group name. All drawing
|
|
75 |
demos extend either the Surface, AnimatingSurface, ControlsSurface or
|
|
76 |
AnimatingControlsSurface classes. Surface is the base class, demos
|
|
77 |
must implement the Surface's render method. All animated demos extend
|
|
78 |
either the AnimatingSurface or the AnimatingControlsSurface classes.
|
|
79 |
Animated demos must implement the reset and step methods. The demos
|
|
80 |
with gui controls extend either the ControlsSurface or the
|
|
81 |
AnimatingControlsSurface classes. Demos with controls must implement
|
|
82 |
the methods in the CustomControlsContext interface.
|
|
83 |
|
|
84 |
|
|
85 |
======================================================================
|
|
86 |
|
|
87 |
Here are some resources for learning about and using the Java2D(TM)
|
|
88 |
|
|
89 |
OpenJDK group page: http://openjdk.java.net/groups/2d/
|
|
90 |
|
|
91 |
Learning Java 2D: http://www.oracle.com/technetwork/articles/java/java2dpart1-137217.html
|
|
92 |
|
|
93 |
Tutorial : http://download.oracle.com/javase/tutorial/2d/
|
|
94 |
Specification: http://download.oracle.com/javase/8/docs/technotes/guides/2d/spec/j2d-bookTOC.html
|
|
95 |
Java 2D (TM) API White Paper : http://www.oracle.com/technetwork/java/javase/tech/2d-142228.html
|
|
96 |
2D FAQ: http://www.oracle.com/technetwork/java/index-137037.html
|