• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

"Hosted" JFileChooser woes

Ernest Friedman-Hill
author and iconoclast
Posts: 24212
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
You can tell a JFileChooser not to display the OK/Cancel buttons by calling setControlButtonsAreShown(false) . But apparently if you then want to replace those built-in buttons with buttons of your own (in this case, so that the JFileChooser can be just one page of a multi-page "wizard") there doesn't seem to be anything the buttons you supply can call that really duplicates the behavior of the built-in ones.
In particular, say you've got a "Save" dialog, and you type the name of a file into the JFileChooser's text field. If your replacement "Save" button calls getSelectedFile() to try to retrieve this, the JFileChooser won't grab the text out of the text field, and the result of the call will be whatever the selected file was before you typed something in.
Does anybody know of a way around this?
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic