JTextFieldの右端にあるように、JTextField内にJButton(フォルダーアイコン画像付き)を配置して、ボタンをクリックするとJFileChooserが開き、ファイルが選択されると、ファイルはJTextField内に表示されます。
このコードを作成しましたが、何も表示されません。
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);
}
}