• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem using FileChooser.readOnly

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Rancher
Posts: 3324
32
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic