Questions tagged [jfilechooser]

JFileChooser is a Java Swing component to provide a simple mechanism for the user to choose a file.

JFileChooser is a Java Swing component to provide a simple mechanism for the user to choose a file. For information about using JFileChooser, see How to Use File Choosers, a section in The Java Tutorial.

1167 questions
9
votes
3 answers

Appending the file type to a file in Java using JFileChooser

I'm trying to save an image using a JFileChooser. I only want the user to be able to save the image as a jpg. However if they don't type .jpg it wont be saved as an image. Is it possible to somehow append ".jpg" to the end of the file? File file =…
Kingteeb
  • 243
  • 2
  • 3
  • 8
8
votes
4 answers

Add .txt extension in JFileChooser

I have a method that get text from a JTextArea, create a file and write text on it as code below: public void createTxt() { TxtFilter txt = new TxtFilter(); JFileChooser fSave = new JFileChooser(); fSave.setFileFilter(txt); int…
Alberto acepsut
  • 1,972
  • 10
  • 41
  • 87
8
votes
2 answers

set the JFileChooser to open current directory

I created a JFileChooser to open a file, but when I select a file and open it,for second the time that i want to select a file, the JFileChooser is not in the current directory. How set the JFileChooser to open the current directory? JFileChooser…
Tofiq
  • 2,901
  • 6
  • 26
  • 34
8
votes
3 answers

making jfilechooser show image thumbnails

I wanted to create a JFileChooser with thumbnail view of image files.So I subclassed FileView and in the method which creates ImageIcon did some scaling sothat thumbnail images are shown. However,the overall effect is that, the filechooser widget…
markjason72
  • 1,653
  • 8
  • 27
  • 47
8
votes
3 answers

Windows native File chooser in java

Apparently, there are (at least?) two different native File choosers on Windows (10). There is this one, which is used by JFileChooser and other programs: And there is that one, for example used by Chrome: I like it much more than the first one…
piegames
  • 975
  • 12
  • 31
8
votes
3 answers

Get user-inputed file name from JFileChooser Save dialog box

This answer to this question may seem obvious, but I'm actually struggling with it quite a bit. I've searched through JFileChooser methods in the API, and I've looked at some of the questions already asked and answered here on stackoverflow. My…
Anya
  • 81
  • 1
  • 1
  • 4
8
votes
4 answers

JFileChooser embedded in a JPanel

I am writing a java program that needs a file open dialog. The file open dialog isn't difficult, I'm hoping to use a JFileChooser. My problem is that I would like to have a dual pane JFrame (consisting of 2 JPanels). The left panel would have a…
Shane
  • 6,045
  • 3
  • 19
  • 7
8
votes
1 answer

Add JFileChooser to Eclipse Window Builder

I am new to eclipse window builder and want to create a simple GUI with it. I want to add the JFileChooser, however it cannot be found in the palette, even though it's a Swing component. I searched through my components, but there is no file…
Carol.Kar
  • 4,581
  • 36
  • 131
  • 264
8
votes
2 answers

JFileChooser ignoring special character folders on OS X

I have one Java program that browse the path of our local file system, for this we have used JFileChooser. If folder name is in simple English works fine on Windows, Mac OS X and Linux. But If I create folder named special character like - ábc Eóz…
Neelam Sharma
  • 2,745
  • 4
  • 32
  • 73
8
votes
3 answers

Making a JFileChooser select the text of the file name but not the extension

I'd like the text in the file name field of the JFileChooser save dialog to select just the file name and not the extension. I currently have this: And want it to look like this: This is a simple change, but one that makes saving a file much…
Kat
  • 4,645
  • 4
  • 29
  • 81
8
votes
2 answers

How do you remove the Ctrl+C action on a JFileChooser?

I'm embedding a JFileChooser in my program in my own frame with other custom components in the frame. Here's a design of my app as it may help visualize my issues: If you can't tell, the lists directly under the JFrame titles are JFileChoosers. …
Daniel Kaplan
  • 62,768
  • 50
  • 234
  • 356
8
votes
4 answers

How to change the look and feel of a single part of a java program

So I'm making a program selection tool, and currently i like the way everything looks with just the java look and feel. the only thing i want to change is the JFileChooser look and feel to Windows. When i call the filechooser and tell it to change…
PulsePanda
  • 1,806
  • 10
  • 33
  • 56
8
votes
3 answers

How to make JFileChooser Default to Computer View instead of My Documents

In the Windows Look and Feel for JFileChooser, the left hand side of the JFileChooser dialog shows five buttons: Recent Items, Desktop, My Documents, Computer, and Network. These each represent Views of the file system as Windows Explorer would show…
shawmanz32na
  • 1,260
  • 3
  • 15
  • 19
7
votes
3 answers

JFileChooser on OS X

JFileChooser looks nothing like the native widget. I seem to remember reading some hack to get it look like the native widget but searching for it know i can't seem to find it again i came across posts that suggest using java.awt.FileChooser but…
Hamza Yerlikaya
  • 49,047
  • 44
  • 147
  • 241
7
votes
2 answers

Clojure dialog box for file selection with filter for files' extensions

This is a continuous crawling for a lipster beginner on Clojure and Java. I have this code to select a file, but I would like to filter the files' extensions that I am looking for. (import javax.swing.JFileChooser) (defn tlt-get-file [ ] …
logigolf
  • 301
  • 1
  • 3
  • 10