title: How to disable resizing of textField in java swing?
body: <p>I have a GUI, which is based on Swing's JPanelthat uses BorderLayout.In the north panel i have added a new JPanel which uses FlowLayout and contains two textField and other components.
  When I change the text of textField and invisible some componets inside this panel, this textField keeps resizing. How can I avoid this? I would like the textField to keep the same size whatever happens. I've tried setSize, setPreferredSize, setMinimumSize with no success.</p>
  
  <pre><code>txtSource = new WebTextField(source);
      txtSource.setMaximumSize(new Dimension(30,20));
      txtSource.setMinimumSize(new Dimension(20, 20));
      txtSource.setEditable(false);
      txtDestination = new WebTextField(destination);
      txtDestination.setMaximumSize(new Dimension(30,20));
      txtDestination.setMinimumSize(new Dimension(20, 20));
  </code></pre>
  
  <p><strong>before:</strong>
  <img src="https://i.stack.imgur.com/8BmMB.png" alt="enter image description here"></p>
  
  <p><strong>after:</strong>
  <img src="https://i.stack.imgur.com/KNrR7.png" alt="enter image description here"></p>