JComponent () { final JPanel panel = new JPanel(new BorderLayout()); panel.add(new JLabel(UIBundle.message("file.chooser.save.dialog.file.name")), BorderLayout.WEST); myFileName.setText(""); myFileName.getDocument().addDocumentListener(new DocumentAdapter() { @Override protected void textChanged(@NotNull DocumentEvent e) { updateOkButton(); } }); panel.add(myFileName, BorderLayout.CENTER); if (myExtensions.getModel().getSize() > 0) { myExtensions.setSelectedIndex(0); panel.add(myExtensions, BorderLayout.EAST); } return panel; }