private static TextFieldWithBrowseButton createBrowseField() { TextFieldWithBrowseButton textField = new TextFieldWithBrowseButton(); textField.setPreferredSize(new Dimension(200, textField.getPreferredSize().height)); textField.setMinimumSize(new Dimension(200, textField.getPreferredSize().height)); final FileChooserDescriptor fileChooserDescriptor = new FileChooserDescriptor(true, false, false, false, false, false) { public boolean isFileSelectable(VirtualFile file) { //noinspection HardCodedStringLiteral return file.getName().endsWith(".png"); } }; textField.addBrowseFolderListener( IdeBundle.message("title.browse.icon"), IdeBundle.message("prompt.browse.icon.for.selected.action"), null, fileChooserDescriptor); InsertPathAction.addTo(textField.getTextField(), fileChooserDescriptor); return textField; }