Results 1 to 5 of 5
  1. #1
    jacob6900 is offline Member
    Join Date
    Nov 2008
    Posts
    5
    Rep Power
    0

    Question set jFileChooser default to details view

    Hello all,

    Does anyone know how to get the File Chooser to default to the details view? Once it is showing you can easily press the button to do it but I want to eliminate the extra click.....

  2. #2
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    8

    Default

    What details?
    Java Code:
    fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    and so on, I did not see a SHOW_DETAILS option.
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

  3. #3
    jacob6900 is offline Member
    Join Date
    Nov 2008
    Posts
    5
    Rep Power
    0

    Default

    Not details...Details view. In the upper right hand corner of the Chooser there are two icons, one for displaying the files or directories in List view and another for displaying in Details view. When opened Chooser defaults to the List view, I would like it to default to the Details view.

    And yes, you did not see a SHOW_DETAILS option. Neither did I...

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,457
    Rep Power
    20

    Default

    The view options do not affect the public properties of the JFileChooser and are implemented as internal details. This does not mean that what you want can't be done, only that you have to do it in a hackish kind of way.

    Basically, you have to obtain a reference to the file chooser's "details" button and click it programmatically. This sample uses my SwingUtils class to obtain the reference, you can use that or roll your own, so long as you can get the reference you need.
    Java Code:
    JFileChooser fileChooser = new JFileChooser();
    AbstractButton button = SwingUtils.getDescendantOfType(AbstractButton.class,
          fileChooser, "Icon", UIManager.getIcon("FileChooser.detailsViewIcon"));
    button.doClick();
    You can get the SwingUtils class from here:
    Swing Utils Java Tips Weblog

    db

  5. #5
    jacob6900 is offline Member
    Join Date
    Nov 2008
    Posts
    5
    Rep Power
    0

    Default

    Darryl,

    Thank you for the example and you're right, it is kinda hackish. But in the absence of anything else....I will try it. Thanks again.

Similar Threads

  1. Jsp Project on Employee Details
    By 82rathi.angara in forum JavaServer Pages (JSP) and JSTL
    Replies: 8
    Last Post: 01-20-2014, 10:34 AM
  2. Updating a view using actions in a seperate view
    By xcallmejudasx in forum Eclipse
    Replies: 0
    Last Post: 10-24-2008, 10:24 PM
  3. WAR issue,please see the details
    By milindvijayshah@gmail.com in forum Advanced Java
    Replies: 0
    Last Post: 07-25-2008, 11:51 AM
  4. Changing color of variables view details
    By mtoledo in forum Eclipse
    Replies: 0
    Last Post: 03-25-2008, 03:35 PM
  5. drop down box details info
    By eeau1973 in forum New To Java
    Replies: 0
    Last Post: 08-11-2007, 10:04 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •