Solved

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

Posted on 2006-06-23
7
263 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

772 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