Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem using FileChooser.readOnly

 
Tina Viessmann
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I've tried to disable the create new folder and rename for a JFileChooser. I know I can use the client property FileChooser.readOnly. I've experiencing some difficulties using that.
Because I only wanted to change the property for one specific file chooser, i've tried:Unfortunately that does not work. But this way i've alread used successfully :
I know I can useBut I don't want to fool arround with the UIManager.

Does anyone have any ideas?

Thank you!
 
Rob Camick
Ranch Hand
Posts: 2584
9
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


In case you are wondering how I knew what the Action name was check out the article on Key Bindings.
 
Tina Viessmann
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rob, thank you for your solution. Unfortunately its not exactly what I'm looking for. I want to remove the 'New Folder' option from the menue and disable the rename functionality for files/folders. (when you double click the file/folder slowly, you can rename it.)
That's what setting the client property should do.

Thank you anyway.

~Tina
 
Rob Camick
Ranch Hand
Posts: 2584
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I see what you mean. I"ve searched all through the source code and can't figure out how the "readOnly" property affects the ability to rename a file.

I suggest you use the UIManager for this. I don't see any downside to your original approach.

I also asked this question with a few more details and a few more code examples that shows what I've tested at: https://forums.oracle.com/forums/thread.jspa?threadID=2298004&tstart=0, if you want to follow that posting as well. If any new information comes up I'll post it here.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If folder navigation is not required, perhaps just loading the filenames into a JList might suit
 
Tina Viessmann
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Rob
Thank you for your effort! I've read your other thread and it describes my problem very well. Let's see what solution results from this.

@Michael
Unfortunately folder navigation is needed. Otherwise I would have put it into a list. Thank you anyway.
 
J. Kleopatra
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, I'm surprised that read-only is not a property of the fileChooser, doooh ...

But I don't see any downside with temporarily changing a UIManager value, practically, just make sure you reset the value to the original:



Fiddling with deeply hidden implementation details is far worse ;-)

Cheers
Jeanette
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic