JFrame width equals 0 after maximizing
<p>Why it returns 0 0??? What am I doing wrong?</p>

<pre><code>public MainFrame() {
        setExtendedState(JFrame.MAXIMIZED_BOTH);
        setVisible(true);
        System.out.println(getWidth() + " " + getHeight());
}
</code></pre>
