Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to draw a coordinate system

 
Tina Boettger
Greenhorn
Posts: 15
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11027
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Abhilash Etikala
Ranch Hand
Posts: 38
Java MySQL Database PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use JFreeChart an open source library for java to generate graphs and charts..
 
Tina Boettger
Greenhorn
Posts: 15
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 436
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 436
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic