title: java 2d graphics - how do I get proper position of objects on the screen
body: <p>I want my objects to change for that small position, for which screen size is changed, whether is an image or graphic shape..</p>
  
  <p>So I don't want:</p>
  
  <pre><code>g.drawImage(someImg, 10, 10); 
  </code></pre>
  
  <p>So how should I do this?
  I have an idea of doing with percentages, is it a good way ? For example, I can give value of 5% to both x and y coordinates, from a total width and total height size.</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <pre><code>public static float getValueOfPercentage(float percentage, float value) {
      return (percentage / 100.0f) * value;
  }
  
  float logoX = panelCenterX - logoCenterX;
  float logoY = getValueOfPercentage(5, panelMaxY);
  g.drawImage(logoImage, logoX, logoY);
  </code></pre>