Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / April 2005

Tip: Looking for answers? Try searching our database.

Restricting JFileChooser

Thread view: 
nsc - 19 Apr 2005 12:46 GMT
Hi All

How can I disable the "create new folder" option (the icon on top
right) in JFileChooser component.

TIA.
Thomas Weidenfeller - 19 Apr 2005 13:59 GMT
> How can I disable the "create new folder" option (the icon on top
> right) in JFileChooser component.

UIManager.put("FileChooser.readOnly", Boolean.TRUE);

/Thomas

Signature

The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq

nsc - 19 Apr 2005 14:19 GMT
Thanx but this dosent really work.
Do I need to do anything else other than set this property. Here is
what I did.

public class MyFileChooser extends JFileChooser
{
 public MyFileChooser()
 {
   super();
   //Added this line
   UIManager.put("FileChooser.readOnly", Boolean.TRUE);
 }
...
...
}

I am using the object of MyFileChooser to display the component.
Arnaud Berger - 19 Apr 2005 14:26 GMT
Hi,

You probably should do this before instanciating the JFileChooser :

UIManager.put("FileChooser.readOnly", Boolean.TRUE);
JFileChooser MyFileChooser chooser=new JFileChooser();

Regards,

Arnaud

> Thanx but this dosent really work.
> Do I need to do anything else other than set this property. Here is
[quoted text clipped - 13 lines]
>
> I am using the object of MyFileChooser to display the component.
Arnaud Berger - 19 Apr 2005 14:32 GMT
Sorry, read :

UIManager.put("FileChooser.readOnly", Boolean.TRUE);
JFileChooser chooser=new JFileChooser();

> Hi,
>
[quoted text clipped - 24 lines]
> >
> > I am using the object of MyFileChooser to display the component.
Andrey Kuznetsov - 19 Apr 2005 23:29 GMT
> UIManager.put("FileChooser.readOnly", Boolean.TRUE);
> JFileChooser chooser=new JFileChooser();

Is it a wrong design?
This has nothing to do with particular UI implementation.
This should be just simple property of JFileChooser (e.g.
setReadOnly(boolean b))

Signature

Andrey Kuznetsov
http://uio.imagero.com Unified I/O for Java
http://reader.imagero.com Java image reader
http://jgui.imagero.com Java GUI components and utilities



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.