Nate Lockwood
Nate Lockwood

Reputation: 3665

Java How to prevent user edits of file name in FileChooser OpenFileDialog

I need an Open Dialog File Chooser that opens files for reading only. I want user to only be able to click on a file name to select it with no option to edit the name. Users should be able to browse to other folders, though.

I'm on Ubuntu 10.11 with the latest Java (as of January).

TIA.

Upvotes: 1

Views: 424

Answers (1)

trashgod
trashgod

Reputation: 205825

This example shows that editable file names is a feature of the FileChooserUI implementation. For example, com.apple.laf.AquaFileChooserUI does not have this capability. The tutorial does not suggest any way that it can be changed, but this FileBrowser may suggest a custom alternative.

Upvotes: 1

Related Questions