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
-1
votes
1 answer

Save JTextPane, and Open it Java

I'm trying to save a file using JFileChooser, but I cant seem to get it to actually save. I've tried a couple of different methods, but I want the user to able to save on desired location. When I hit the "Save" button it says that it's saved. But…
-1
votes
3 answers

FileChooser in actionListeners

I am trying to code a small text editor and I was building the GUI. I added a JMenu and added a JMenuItem to it. I gave the menu item the value of "open". The reason is because I want that when "open" is pressed a JFileChooser appears on the…
Bula
  • 2,398
  • 5
  • 28
  • 54
-1
votes
1 answer

Need help using JFileChooser for the first time

To be blunt about it, I'm looking for help as to how to actually use it. We have just been set work using this on my course, but our new teacher does not teach, and I'm really struggling with this one. So I have a basic JFrame set up using windows…
Daniel Speed
  • 90
  • 1
  • 3
  • 11
-1
votes
1 answer

Filechooser doesn't do anything

So for a project I'm making I need to import pictures. But the only problem is that my filter, filters everything and I never recieve A file back public class FileChooser extends JPanel{ public FileChooser(){ JFileChooser fileopen=new…
stevedc
  • 483
  • 3
  • 8
  • 26
-1
votes
2 answers

JFileChooser that manually picks the file

I was just wondering. Is there any way to use JFileChooser but open the file manually? So I could put the directory somewhere in code before and then just load it? Here is part of my code: JFileChooser fc = new JFileChooser(); if…
Akarasu
  • 45
  • 3
  • 7
-1
votes
1 answer

JFileChooser(showSaveDialog) cant get the value of the extension file chosen

Im making a desktop application and it has a JFileChooser(ShowSaveDialog) function.. When I tried to save a sample text file the program didnt get the extension file that I chose.. I'm trying to use the if else or switch statement and I cant figure…
John
  • 43
  • 2
  • 6
-1
votes
2 answers

Is there any method of JFileChooser which can provide me a file's path with Double slash "\\"?

In Netbeans I am using a JFileChooser to get a file's path. All is OK and its giving me the path as well with single slash \. But I need the path with double slash \\. So my question is, is there already any kind of method which can provide me that…
Tushar Monirul
  • 4,944
  • 9
  • 39
  • 49
-1
votes
3 answers

How to save the text file in a path given by JFileChooser?

I need to save a text File which is already created in a particular path given by JFileChooser. What I do basically to save is: public void actionPerformed(ActionEvent e) { JFileChooser chooser = new JFileChooser(); int status =…
Albert
  • 142
  • 1
  • 8
-1
votes
2 answers

FileChooser getAttachement only from this Folder

How to make the user to select the file from only specified folder int returnVal = fc.showOpenDialog(FileChooser.this); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); source = file.getAbsolutePath(); …
vijay
  • 1,129
  • 7
  • 22
  • 34
-1
votes
2 answers

select and run a java class or call a method in a class using JFileChooser on an other class (GUI)

I have a file A.java containing a class A with a method aMethod() that is saved on a folder on the PC (not inside the package or workspace). I have a JFileChooser on another class (GUI). I want to be able to select class A and run it, or call…
G35x
  • 1
-1
votes
2 answers

Panel losing color

When I click on the button that activates the file chooser, and add the resulting file the panel color disappears. Does anyone know why this is happening? import javax.swing.JPanel; import javax.swing.JButton; import javax.swing.JLabel; import…
Yaser Har
  • 149
  • 1
  • 2
  • 11
-1
votes
3 answers

JFileChooser don't want to close

I'm using JFileChooser which don't want to close after I press close button. The problem is that after I press the close button, it opens again 3+ times, and finally closes. My code: javaButton.addActionListener(new ActionListener() { public void…
-1
votes
1 answer

Why doesn't my code function like it should? (fileWriter, jTable)

Still having some issues with my code. No errors this time, its just not functioning properly! here's the code: http://pastebin.com/nm633L1v What's not working (I think): fileWriter jTable 3rd Party Libraries: OpenCSV filechooser.FileFilter : just…
ccreason
  • 189
  • 1
  • 7
-2
votes
1 answer

unable to read files from a directory using JFileChooser

This is a sample folder structure : mahesh aaa(folder) aa(subfolder) a1(file) xx(file) bbb(folder) bb(subfolder) b1(file) yy(file) ccc(folder) cc()folder) c1(file) …
mahesh
  • 337
  • 4
  • 13
-2
votes
1 answer

Java JFileChooser - I can choose a .txt only in a directory i set

Hi im working in a java project and i wanted to create a JFileChooser which i have but i want to choose only in one directory like i have the directory called "Saves" and i want the person who open the JFileChooser can only access txt inside the…