Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (686)
Games in Android Showcase (198)
games submitted by our members
Games in WIP (758)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  translate Graphics2D ?!  (Read 1233 times)
0 Members and 1 Guest are viewing this topic.
Offline grisch

Junior Newbie




Think positiv !


« Posted 2003-05-27 11:15:24 »

Hi
I want to have something like a speedometer. I draw it with Java2D
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
Graphics2D g2d = ( Graphics2D ) new Graphics;
GeneralPath filledPolygon = new GeneralPath();

filledPolygon.moveTo( x, yo1 );
filledPolygon.lineTo( x, yu1 );
filledPolygon.lineTo( x1, yu1 );
filledPolygon.lineTo( x1, yu2 );
filledPolygon.lineTo( x2, y );
filledPolygon.lineTo( x1, yo2 );
filledPolygon.lineTo( x1, yo1 );
filledPolygon.lineTo( x, yo1 );

AffineTransform af = new AffineTransform();
af.translate(676, 75);
af.rotate( Math.PI );
af.scale(0.5, 0.6);

filledPolygon.transform(af);

g2d.setPaint( Color.white );
g2d.fill( filledPolygon );

If I have now an event, then I want to change to position of "filledPolygon". How can I do that?

I found out, that i can translate the Graphics2D-Object, but this does not affect on my already created "filledPolygon" !

Any ideas?
Thanks, Flavio
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 
roseslayer (478 views)
2016-08-06 11:43:29

roseslayer (434 views)
2016-08-06 09:43:11

xTheGamerCodes (511 views)
2016-08-04 15:40:59

xTheGamerCodes (504 views)
2016-08-04 15:40:24

orrenravid (852 views)
2016-07-16 03:57:23

theagentd (929 views)
2016-07-11 14:28:54

Hydroque (1025 views)
2016-07-06 05:56:57

Hydroque (1018 views)
2016-07-03 08:52:54

GrandCastle (833 views)
2016-07-01 09:13:47

GrandCastle (640 views)
2016-07-01 09:09:45
Rendering resources
by Roquen
2016-08-08 05:55:21

Rendering resources
by Roquen
2016-08-08 05:52:42

Rendering resources
by Roquen
2016-08-08 05:50:38

Rendering resources
by Roquen
2016-08-08 05:49:53

Rendering resources
by Roquen
2016-08-08 05:32:39

Making a Dynamic Plugin System
by Hydroque
2016-06-25 00:13:25

Java Data structures
by BinaryMonkL
2016-06-13 21:22:09

Java Data structures
by BinaryMonkL
2016-06-13 21:20:42
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!