Forum Stats

  • 3,817,472 Users
  • 2,259,339 Discussions
  • 7,893,790 Comments

Discussions

can i disable all features of Jfilechosser in java swing

Kkus
Kkus Member Posts: 5
edited Aug 21, 2017 9:36AM in Java Programming

i want to disable all icon of Jfilechooser control (like new folder , up level , desktop icon) and also fix a directory there no user change this directory...

how i do this

please ... help me

thanks in advance

Tagged:
Kkus

Answers

  • Unknown
    edited May 21, 2017 12:21PM
    i want to disable all icon of Jfilechooser control (like new folder , up level , desktop icon) and also fix a directory there no user change this directory... how i do this 

    That makes no sense so isn't supported. Those icons are there for a reason.

    Create your own 'chooser' if you want your own functionality.

    Permissions on folders/directories are set at the operating system - that has NOTHING to do with Java.

    I suggest you work your way through The Java Tutorials. There are trails that cover ALL of the basic Java functionality. Here is the one for files

    https://docs.oracle.com/javase/tutorial/essential/io/file.html

    Reading, Writing, and Creating Files

    This page discusses the details of reading, writing, creating, and opening files. There are a wide array of file I/O methods to choose from. To help make sense of the API, the following diagram arranges the file I/O methods by complexity.
    KkusKkus
  • jduprez
    jduprez Member Posts: 2,457
    edited Aug 21, 2017 9:36AM

    This page of the Java Tutorial shows how to filter the files viewable (e.g. mask directories): https://docs.oracle.com/javase/tutorial/uiswing/components/filechooser.html

    I doubt masking directories prevents to navigate up, but try it, and let us know.

    For the buttons, you can probably traverse the widget hierarchy (with getContentPane()/getChildren()... and setVisible/setEnabled(false) the buttons that you don't want).

    KkusKkus
This discussion has been closed.