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 7932077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T20:54:26+00:00 2026-06-03T20:54:26+00:00

I want to create a new file while file type is choosing by the

  • 0

I want to create a new file while file type is choosing by the user on JFileChooser. How this is possible. I use this code for JFileChooser:

JFileChooser chooser = new JFileChooser();
chooser.setDialogTitle("Save data in your file format");

FileFilter type1 = new ExtensionFilter("Access 2007 Database(*.accdb)", ".accdb");
FileFilter type2 = new ExtensionFilter("Access 2002-2003 Database(*.mdb)", ".mdb");

chooser.addChoosableFileFilter(type1);
chooser.addChoosableFileFilter(type2);

int actionDialog = chooser.showSaveDialog(frame);

Now I an able to get the “File Name” when the user select any file by this code:

 chooser.getSelectedFile().getName();

But I dont know how to get “Files of type” when user select any file.
For the convenience I also attach photo of JFileChooser:
enter image description here

  • 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-06-03T20:54:28+00:00Added an answer on June 3, 2026 at 8:54 pm

    You can get that information using JFileChooser .getFileFilter()

    From the Javadocs:

    Returns the currently selected file filter

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create a new object using this $procedure = new ${$s.'\\'.$p}; It
I want to create a new web-browser for android, but this browser is not
In C# code, I want create a log file for each each method in
I want to create new node of BeanTreeView, and when I add some node
I want to create a new business application using the Django framework. Any suggestions
I want to create a new Subversion repository through Aptana Studio. Both Aptana SVN
I want to create a new Menu in the admin panel of Wordpress for
i want to create a new '.b' div appendTo document.body, and it can dragable
I want to create a new column in a MYSQL table that has Fn
I want to create a new ClassLoader everytime my method is called. So I

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.