title: Coordinate transformation Dilemma, User coordinate to Device coordinate?
body: <p>I am working on a task which includes data such as "length" of a road in "millimetre". And as per the specification my JFrame should be 4meter * 3meter ( How to convert this into device coordinate...?).</p>
  
  <p>Now, I know at least that this data is real world data and not device's pixel data. However after finding out few sources you can actually transform these data into pixel by Graphics2D class.</p>
  
  <p>Resource I found these information is in, </p>
  
  <blockquote>
    <p>Core Java 2, Volume II - Advanced Feature, Author - Cay S. Horstmann &amp; Gary Cornell</p>
  </blockquote>
  
  <p>However, I googled for actual examples with no luck.</p>
  
  <p>Does anyone know any source where I can read more about this. And if you have any examples where someone has actually did something like this, That would be more informative.</p>
  
  <blockquote>
    <p>Research so far : So far I know that we need to give a assumptions to Graphics2D class of number of pixels in meters. In Graphics2D there is method which helps you to set this assumption. Method is ,</p>
  </blockquote>
  
  <pre><code>g2D.scale(pixelsPerMeter, pixelsPerMeter);
  //And than I can draw a line with meter or millimetre coordinates
  g2D.draw(new Line2D.Double(coordinates in meter));
  </code></pre>
  
  <blockquote>
    <p>I tried above code but really hard to draw line where I actually want to.</p>
  </blockquote>
  
  <p>Any help of understanding will be very helpful. </p>
  
  <p>Thanks</p>