Solved

Code of the drawing of a Shape object (Arc2D)?

Posted on 2006-06-23
7
264 Views
Last Modified: 2010-03-31
Hello

Since Java is open source, could someone get me the code that is used to fill and draw an Java Arc2D object?
Im coding on J2ME phones that have a sh*tty implementation of arc drawing and filling... so i want to replace them with efficient functions.
Thanks
0
Comment
Question by:oroussea
  • 4
  • 3
7 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 16971035
You can't be *given* the source, but you can access it yourself in src.zip in your JDK
0
 

Author Comment

by:oroussea
ID: 16971133
Thanks for the lightning fast reply CEHJ!

I tried what you said... and the only thing i could is this:

public abstract void draw(Shape s);

I couldn't find the *real* implementation for the Arc2D... might look something like this:

void draw(Shape s)
{
   if s.type == ARC2D
   // do actual drawing of arc here -> Code im interested in
   else if (s.type == )
}
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 16971172
Well actually Shape doesn't draw itself. Graphics draws it. Look at that class and also maybe Graphics2D
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

Author Comment

by:oroussea
ID: 16971224
Cant find it... i found drawArc and fillArc functions... but they are abstract... no implementation...

draw(Shape s) is also abstract...

do you have src.zip? could have a look? maybe you would find something...

Thanks again
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 125 total points
ID: 16971418
>>Since Java is open source

By no means. They simply let you see *some* of the source

>>i found drawArc and fillArc functions... but they are abstract...

Yes, you'd need to look at the source of the Graphics implementation. On my machine, that is

class sun.java2d.SunGraphics2D

which won't be in src.zip. *still* think it's open source? ;-)
0
 

Author Comment

by:oroussea
ID: 16971656
Ok thanks for the info!

Btw, i found the source code here:

http://www.cs.duke.edu/csed/java/src1.3/sun/java2d/

Since its an educational website, it must be legal...
Thanks
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 16971678
:-)
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
V.simple question about Android packages and libraries 1 29
how to see all occupied ports on windows 10 laptop 15 76
mysql jsp example issue 32 48
CSV file parsing thru Java 13 34
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question