title: How to put a JButton inside a JTextField (Java)?
body: <p>I would like to have a JButton (with a folder icon image) inside a JTextField, like over on the far right of the JTextField, so that when clicked, the button opens up a JFileChooser, and when a file is selected, the path to the file appears inside the JTextField.</p>
  
  <p>I have made this code, but nothing shows up.</p>
  
  <pre><code>public class TextFieldChooser extends JTextField {
  
      public ImageIcon folderIcon;
      public JButton btnFolder;
  
      public TextFieldChooser(int columns) {
          super(columns);
          btnFolder = new JButton();
          folderIcon = new ImageIcon(getClass().getResource("/resources/folder_find.png"));
          btnFolder.setIcon(folderIcon);
          this.add(btnFolder);
  
      }
  }
  </code></pre>