Source Code Cross Referenced for RenderingAccuracy.java in  » Database-Client » prefuse » test » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database Client » prefuse » test 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * Copyright (c) 2004-2006 Regents of the University of California.
003:         * See "license-prefuse.txt" for licensing terms.
004:         */package test;
005:
006:        import java.awt.Color;
007:        import java.awt.Dimension;
008:        import java.awt.Graphics;
009:        import java.awt.Graphics2D;
010:        import java.awt.geom.Line2D;
011:        import java.awt.geom.Rectangle2D;
012:
013:        import javax.swing.JComponent;
014:        import javax.swing.JFrame;
015:
016:        /**
017:         * @author <a href="http://jheer.org">jeffrey heer</a>
018:         */
019:        public class RenderingAccuracy extends JComponent {
020:
021:            public RenderingAccuracy() {
022:                setPreferredSize(new Dimension(100, 120));
023:                setBackground(Color.WHITE);
024:                setForeground(new Color(100, 100, 255));
025:            }
026:
027:            public void paintComponent(Graphics g) {
028:                Graphics2D g2D = (Graphics2D) g;
029:                g2D.setColor(getBackground());
030:                g2D.fillRect(0, 0, getWidth(), getHeight());
031:                g2D.setColor(getForeground());
032:                rects(g2D);
033:                lines(g2D);
034:            }
035:
036:            public void rects(Graphics2D g2D) {
037:                Rectangle2D r = new Rectangle2D.Double();
038:                double x = 10, y = 4;
039:                int inc = 5;
040:
041:                // g2D.draw() - vary start coord
042:                for (int i = 0; i <= 10; ++i) {
043:                    r.setFrame(x + i * 0.1, y + 5 * i, 2, 3);
044:                    g2D.draw(r);
045:                }
046:                x += inc;
047:
048:                // g2D.draw() - vary width
049:                for (int i = 0; i <= 10; ++i) {
050:                    r.setFrame(x, y + 5 * i, 2 + i * 0.1, 3);
051:                    g2D.draw(r);
052:                }
053:                x += inc;
054:
055:                // g2D.fill() - vary start coord
056:                for (int i = 0; i <= 10; ++i) {
057:                    r.setFrame(x + i * 0.1, y + 5 * i, 2, 3);
058:                    g2D.fill(r);
059:                }
060:                x += inc;
061:
062:                // g2D.fill() - vary width
063:                for (int i = 0; i <= 10; ++i) {
064:                    r.setFrame(x, y + 5 * i, 2 + i * 0.1, 3);
065:                    g2D.fill(r);
066:                }
067:                x += inc;
068:
069:                x += inc;
070:
071:                // optimized draw - vary start coord
072:                for (int i = 0; i <= 10; ++i) {
073:                    r.setFrame(x + i * 0.1, y + 5 * i, 2, 3);
074:                    draw(g2D, r);
075:                }
076:                x += inc;
077:
078:                // optimized draw - vary width
079:                for (int i = 0; i <= 10; ++i) {
080:                    r.setFrame(x, y + 5 * i, 2 + i * 0.1, 3);
081:                    draw(g2D, r);
082:                }
083:                x += inc;
084:
085:                // optimized fill - vary start coord
086:                for (int i = 0; i <= 10; ++i) {
087:                    r.setFrame(x + i * 0.1, y + 5 * i, 2, 3);
088:                    fill(g2D, r);
089:                }
090:                x += inc;
091:
092:                // optimized fill - vary width
093:                for (int i = 0; i <= 10; ++i) {
094:                    r.setFrame(x, y + 5 * i, 2 + i * 0.1, 3);
095:                    fill(g2D, r);
096:                }
097:                x += inc;
098:
099:                // -- next row -------------------------------
100:                x = 10.35;
101:                y += 60;
102:
103:                // g2D.draw() - vary start coord
104:                for (int i = 0; i <= 10; ++i) {
105:                    r.setFrame(x + i * 0.1, y + 5 * i, 2, 3);
106:                    g2D.draw(r);
107:                }
108:                x += inc;
109:
110:                // g2D.draw() - vary width
111:                for (int i = 0; i <= 10; ++i) {
112:                    r.setFrame(x, y + 5 * i, 2 + i * 0.1, 3);
113:                    g2D.draw(r);
114:                }
115:                x += inc;
116:
117:                // g2D.fill() - vary start coord
118:                for (int i = 0; i <= 10; ++i) {
119:                    r.setFrame(x + i * 0.1, y + 5 * i, 2, 3);
120:                    g2D.fill(r);
121:                }
122:                x += inc;
123:
124:                // g2D.fill() - vary width
125:                for (int i = 0; i <= 10; ++i) {
126:                    r.setFrame(x, y + 5 * i, 2 + i * 0.1, 3);
127:                    g2D.fill(r);
128:                }
129:                x += inc;
130:
131:                x += inc;
132:
133:                // optimized draw - vary start coord
134:                for (int i = 0; i <= 10; ++i) {
135:                    r.setFrame(x + i * 0.1, y + 5 * i, 2, 3);
136:                    draw(g2D, r);
137:                }
138:                x += inc;
139:
140:                // optimized draw - vary width
141:                for (int i = 0; i <= 10; ++i) {
142:                    r.setFrame(x, y + 5 * i, 2 + i * 0.1, 3);
143:                    draw(g2D, r);
144:                }
145:                x += inc;
146:
147:                // optimized fill - vary start coord
148:                for (int i = 0; i <= 10; ++i) {
149:                    r.setFrame(x + i * 0.1, y + 5 * i, 2, 3);
150:                    fill(g2D, r);
151:                }
152:                x += inc;
153:
154:                // optimized fill - vary width
155:                for (int i = 0; i <= 10; ++i) {
156:                    r.setFrame(x, y + 5 * i, 2 + i * 0.1, 3);
157:                    fill(g2D, r);
158:                }
159:                x += inc;
160:            }
161:
162:            public void lines(Graphics2D g2D) {
163:                Line2D r = new Line2D.Double();
164:                double x = 60, y = 4;
165:                int inc = 5;
166:
167:                // g2D.draw() - vary start coord
168:                for (int i = 0; i <= 10; ++i) {
169:                    double x1 = x + i * 0.1;
170:                    double y1 = y + 5 * i;
171:                    r.setLine(x1, y1, x1 + 2, y1);
172:                    g2D.draw(r);
173:                }
174:                x += inc;
175:
176:                // g2D.draw() - vary width
177:                for (int i = 0; i <= 10; ++i) {
178:                    double x2 = x + 2 + i * 0.1;
179:                    double y1 = y + 5 * i;
180:                    r.setLine(x, y1, x2, y1);
181:                    g2D.draw(r);
182:                }
183:                x += inc;
184:
185:                x += inc;
186:
187:                // optimized draw - vary start coord
188:                for (int i = 0; i <= 10; ++i) {
189:                    double x1 = x + i * 0.1;
190:                    double y1 = y + 5 * i;
191:                    r.setLine(x1, y1, x1 + 2, y1);
192:                    draw(g2D, r);
193:                }
194:                x += inc;
195:
196:                // optimized draw - vary width
197:                for (int i = 0; i <= 10; ++i) {
198:                    double x2 = x + 2 + i * 0.1;
199:                    double y1 = y + 5 * i;
200:                    r.setLine(x, y1, x2, y1);
201:                    draw(g2D, r);
202:                }
203:                x += inc;
204:
205:                // -- next row -------------------------------
206:                x = 60 + 0.35;
207:                y += 60;
208:
209:                // g2D.draw() - vary start coord
210:                for (int i = 0; i <= 10; ++i) {
211:                    double x1 = x + i * 0.1;
212:                    double y1 = y + 5 * i;
213:                    r.setLine(x1, y1, x1 + 2, y1);
214:                    g2D.draw(r);
215:                }
216:                x += inc;
217:
218:                // g2D.draw() - vary width
219:                for (int i = 0; i <= 10; ++i) {
220:                    double x2 = x + 2 + i * 0.1;
221:                    double y1 = y + 5 * i;
222:                    r.setLine(x, y1, x2, y1);
223:                    g2D.draw(r);
224:                }
225:                x += inc;
226:
227:                x += inc;
228:
229:                // optimized draw - vary start coord
230:                for (int i = 0; i <= 10; ++i) {
231:                    double x1 = x + i * 0.1;
232:                    double y1 = y + 5 * i;
233:                    r.setLine(x1, y1, x1 + 2, y1);
234:                    draw(g2D, r);
235:                }
236:                x += inc;
237:
238:                // optimized draw - vary width
239:                for (int i = 0; i <= 10; ++i) {
240:                    double x2 = x + 2 + i * 0.1;
241:                    double y1 = y + 5 * i;
242:                    r.setLine(x, y1, x2, y1);
243:                    draw(g2D, r);
244:                }
245:                x += inc;
246:            }
247:
248:            public void draw(Graphics2D g, Line2D r) {
249:                int x1 = (int) r.getX1();
250:                int y1 = (int) r.getY1();
251:                int x2 = (int) r.getX2();
252:                int y2 = (int) r.getY2();
253:                g.drawLine(x1, y1, x2, y2);
254:            }
255:
256:            public void draw(Graphics2D g, Rectangle2D r) {
257:                int x = (int) r.getMinX();
258:                int y = (int) r.getMinY();
259:                int w = (int) (r.getWidth() + r.getMinX() - x);
260:                int h = (int) (r.getHeight() + r.getMinY() - y);
261:                g.drawRect(x, y, w, h);
262:            }
263:
264:            public void fill(Graphics2D g, Rectangle2D r) {
265:                int x = (int) r.getMinX();
266:                int y = (int) r.getMinY();
267:                int w = (int) (r.getWidth() + r.getMinX() - x);
268:                int h = (int) (r.getHeight() + r.getMinY() - y);
269:                g.fillRect(x, y, w, h);
270:            }
271:
272:            /**
273:             * @param args
274:             */
275:            public static void main(String[] args) {
276:                JFrame f = new JFrame("rendering accuracy");
277:                f.setContentPane(new RenderingAccuracy());
278:                f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
279:                f.pack();
280:                f.setVisible(true);
281:            }
282:
283:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.