wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes conversion of pixel to millimeter Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "conversion of pixel to millimeter" Watch "conversion of pixel to millimeter" New topic
Author

conversion of pixel to millimeter

Rohit Bhagwat
Ranch Hand

Joined: Dec 19, 2004
Posts: 205
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

Joined: Jul 11, 2001
Posts: 14112
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.


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
And take a look at http://java.sun.com/products/jfc/tsc/articles/text/tabs/
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: conversion of pixel to millimeter
 
Similar Threads
Ruler in mm
Out of bounds Exception
WA #1.....word association
help required
Measurement ruler in Swing