File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "conversion of pixel to millimeter" Watch "conversion of pixel to millimeter" New topic

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
Ilja Preuss

Joined: Jul 11, 2001
Posts: 14112
Take a look at


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

Joined: Jul 11, 2001
Posts: 14112
And take a look at
I agree. Here's the link:
subject: conversion of pixel to millimeter
It's not a secret anymore!