Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5958707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:34:54+00:00 2026-05-22T18:34:54+00:00

I just added a standard Open file dialog to a small desktop app I’m

  • 0

I just added a standard “Open file” dialog to a small desktop app I’m writing, based on the JFileChooser entry of the Swing Tutorial. It’s generating a window that looks like this:

screenshot of unwanted/XP-style window

but I would prefer to have a window that looks like this:

screenshot of desired/7-style window

In other words, I want my file chooser to have Windows Vista/Windows 7’s style, not Windows XP’s. Is this possible in Swing? If so, how is it done? (For the purposes of this question, assume that the code will be running exclusively on Windows 7 computers.)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T18:34:54+00:00Added an answer on May 22, 2026 at 6:34 pm

    It does not appear this is supported in Swing in Java 6.

    Currently, the simplest way I can find to open this dialog is through SWT, not Swing. SWT’s FileDialog (javadoc) brings up this dialog. The following is a modification of SWT’s FileDialog snippet to use an open instead of save dialog. I know this isn’t exactly what you’re looking for, but you could isolate this to a utility class and add swt.jar to your classpath for this functionality.

    import org.eclipse.swt.*;
    import org.eclipse.swt.widgets.*;
    
    public class SWTFileOpenSnippet {
        public static void main (String [] args) {
            Display display = new Display ();
            Shell shell = new Shell (display);
            // Don't show the shell.
            //shell.open ();  
            FileDialog dialog = new FileDialog (shell, SWT.OPEN | SWT.MULTI);
            String [] filterNames = new String [] {"All Files (*)"};
            String [] filterExtensions = new String [] {"*"};
            String filterPath = "c:\\";
            dialog.setFilterNames (filterNames);
            dialog.setFilterExtensions (filterExtensions);
            dialog.setFilterPath (filterPath);
            dialog.open();
            System.out.println ("Selected files: ");
            String[] selectedFileNames = dialog.getFileNames();
            for(String fileName : selectedFileNames) {
                System.out.println("  " + fileName);
            }
            shell.close();
            while (!shell.isDisposed ()) {
                if (!display.readAndDispatch ()) display.sleep ();
            }
            display.dispose ();
        }
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just added adds to my app, but the moment i run it i
I have just added a Core Plot view to my application based on a
I have just added cancan 1.5.0 to my rails 3 app here is my
I have just added the code to my index.html and uploaded the file. But
I just added this to my web.xml on my JBOSS server. But it had
I just added PrimeFaces 3.0 to a JSF project: <repository> <id>prime-repo</id> <name>PrimeFaces Maven Repository</name>
i just added a launch image to an application i wrote. According to several
I just added an ExecutionHandler to my server pipeline just before my main business
I just added the GreenDroid Library into my Application. I extended the startview with
I just added a Facebook like button to my website, just the most basic

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.