title: Set maximum size of JFrame
body: <p>I'm starting my journey with Java and I'm playing with swing. I made some simple <em>JFrame</em> with <em>JScrollPane</em> inside and I'm looking for a way to restrict my frame to preset minimum and maximum size. I've searched the net about <em>setMaximum</em> and <em>setMinimum</em> and how wrong they are, but I haven found nothing(Except some weird <em>ComponentListener</em>). However <em>setMinimum</em> is working fine(at least for now) but i can't get <em>setMaximum</em> to work. How can I set such constraints?</p>
  
  <p><strong>EDIT:</strong><br>
  What I mean by "Except some weird <em>ComponentListener</em>" is that it lets me resize frame, then just resize it back. What I want to achive is invisible bound, that prevents frame from going more.</p>
  
  <p><strong>EDIT2:</strong><br>
  It seems that this problem concerns my OS(which is OSX), <em>ComponentListener</em> works fine on Windows. But on Mac, when I start dragging the window out, <em>ComponentMoved</em> is called and only when I release mouse button <em>ComponentResized</em> is called. When I copy code from <em>Resized</em> to <em>Moved</em>, first, window resize itself over <em>MaximumSize</em> for fraction of second, then apropiet code is called and everything is fine, but this flicker is far from acceptable. I've even overloaded <em>paint(Graphics g)</em> to first reset size and then call <em>super.paint</em> but with same result.</p>