This week's book giveaway is in the Cloud forum.
We're giving away four copies of The Business Blockchain and have William Mougayar on-line!
See this thread for details.
Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

conversion of pixel to millimeter

 
Rohit Bhagwat
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello friends, sir, madam

I want to set ruler/scale on my panel. This ruler is calibrated in millimeters(mm). I guess java has not provided any standard component to draw ruler. So I am trying to draw the ruler. I am thinking of drawing lines after each mm. For this I might need, after how much pixels should I draw that 1mm line ? This actually depends on screen resoltuion. I dont know whether my approach is right or not.

Please comment on this or if possible suggest some alternative solution. Please help.

Waiting for your replies

Thanks and Regards
Rohit.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a look at

java.awt.Toolkit.getScreenResolution()

Get the toolkit from your component, *do not* use the default toolkit - the latter doesn't work well if you have more than one display.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And take a look at http://java.sun.com/products/jfc/tsc/articles/text/tabs/
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic