title: How to obtain the bounds of the axis box in a JFrame?
body: <p>I got the answer on my <a href="https://stackoverflow.com/questions/39395912/matlab-the-exact-size-and-position-of-the-axis-box-in-the-case-of-axis-equal">previous question</a>. However, to get these coordinates (size and position of the axis box in the case of <code>axis equal</code>) we need to do some relatively cumbersome calculations. However, since MATLAB graphics is based on Java, we can get access to Java properties.
  I have found that if we use this in MATLAB:</p>
  
  <pre><code>jFrame = get(gcf,'JavaFrame');
  BoxHeight = jFrame.getAxisComponent.getHeight;
  BoxWidth = jFrame.getAxisComponent.getWidth;
  </code></pre>
  
  <p>we can obtain a width and height of figure windows (maybe this can be associated with the components of the axis). But they are differ from the value of <code>get(gcf, 'Position')</code> or <code>get(gca, 'Position')</code> in the case of pixel units. I'm not an expert in Java (I also unsuccessfully tried to find these properties using Altman's <code>findjobj</code>).</p>
  
  <p>Thus, I have two questions:</p>
  
  <ol>
  <li>Why the height and width of the figure window (maybe this is the axis box) derived from the properties of MATLAB and Java are not the same (at least, they are integers in Java and floating-point numbers in MATLAB)?</li>
  </ol>
  
  <p>For example:</p>
  
  <pre><code>hf=figure('units','pixels'); ha=gca(hf);
  set(ha,'units','pixels');
  get(hf,'position')
  get(ha,'position')
  </code></pre>
  
  <p>ans =</p>
  
  <pre><code>488   342   560   420
  73.8000   47.2000  434.0000  342.3000`
  </code></pre>
  
  <p>whereas <code>BoxHeight=525</code>, <code>BoxWidth=700</code> and the shift is always zero (<code>alignmentX=0.0</code> and <code>alignmentY=0.0</code>).</p>
  
  <ol start="2">
  <li>How to get the exact size and position of the window axes plotted in MATLAB <strong>using Java</strong>?</li>
  </ol>