Solved

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

Posted on 2006-06-23
7
262 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

762 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

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now