aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes How to draw a coordinate system Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to draw a coordinate system" Watch "How to draw a coordinate system" New topic
Author

How to draw a coordinate system

Tina Boettger
Greenhorn

Joined: Apr 05, 2011
Posts: 15

Hey!

My problem is that i am drawing a 3D-function with Graphics2D but also need to show the
axis. I want to draw a coordinate system, scale if necessary, add labels etc.
Are there any predefined classes/methods I can use, for example to draw a line with
dashes on it? Or do I need to code it all from "scratch"?

Thank you for your time
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10535
    
    9

This can be achieved using Graphics and Graphics2D
Check out http://download.oracle.com/javase/1.4.2/docs/guide/2d/spec/j2d-awt.html


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Abhilash Etikala
Ranch Hand

Joined: Nov 08, 2009
Posts: 38

You can use JFreeChart an open source library for java to generate graphs and charts..
Tina Boettger
Greenhorn

Joined: Apr 05, 2011
Posts: 15

Maneesh Godbole wrote:This can be achieved using Graphics and Graphics2D
Check out http://download.oracle.com/javase/1.4.2/docs/guide/2d/spec/j2d-awt.html

Thank you for the link. I am already using Graphics/Graphics2D. I just wished for an easier way
to generate the axis, instead of drawing every line manually. But I guess there isn't any...
so off to Eclipse
Thanks again!

Abhilash Etikala wrote:You can use JFreeChart an open source library for java to generate graphs and charts..

Thank you Abhilash, my task is to build almost exactly the same functionality as the jfreechart, because it is quite buggy and not fast enough
for the vast data we have to process.
Hauke Ingmar Schmidt
Rancher

Joined: Nov 18, 2008
Posts: 433
    
    2
Tina Boettger wrote:
Are there any predefined classes/methods I can use, for example to draw a line with
dashes on it? Or do I need to code it all from "scratch"?


Have a look into your JDK's demo folder, take a look at jfc/Java2D.
Tina Boettger
Greenhorn

Joined: Apr 05, 2011
Posts: 15

Thank you for your help
Unfortunately I cannot find a jdk on my system? only the jre
How does Eclipse work without it or does it have some kind of hidden
install... maybe that is the reason that I am not seeing all javadoc..
I will go and install it...
Hauke Ingmar Schmidt
Rancher

Joined: Nov 18, 2008
Posts: 433
    
    2
Exactly.

javac.exe (on Windows) is just a frontend for a java class that is able to compile. You technically don't need a JDK for compiling code. Eclipse doesn't come with a JDK and doesn't need one. But it is extremely helpful - the JavaDocs, the source code, the demos. While you can setup those manually for the JRE it is much easier to just install the JDK. Then set it as primary Java runtime under Window -> Preferences -> Java -> Installed JREs. Add a new one, check it as default. (And delete the other entry for the JRE, as it is not needed and you don't want it to accidentally setup as JRE for a project.)
Tina Boettger
Greenhorn

Joined: Apr 05, 2011
Posts: 15

I feel a little bit embarassed now
Didn't even notice there was no JDK installed
Now I will try overlaying a vertically dashed line with a normal
line... maybe that will do the trick.

Thanks again!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to draw a coordinate system