File Choose question

Hello everyone
I am working on a swing application. I have a JFileChooser dialog and I wish to display all files that conform to a certain file filter, i.e.:
tst*.jpg.
I have used the file filter provided by Java in order to show only jpg files but I also need to be able to use the tst.
Has anyone done something like this before?
I have noticed that the user can type in the file name something like tst*.jpg and the dialog will only show files starting with tst that have an extension of jpg. I tryed to use a file filter and add the entire file but it ignores, as expected the ".", and creates a filter of the form ".tst*.jpg".
I have used the method JFileChooser.SetName() and have set the string "tst*.jpg" but with no results.
I have used the method JFileChooser.setSelectedFile() with parameter
a file derived from the string "tst*.jpg". Still no results.
Thanks for your time and responses.

JFileChooser has a built-in FileFilter to handle regular expressions
that the user types in. It is quite complex, but you can take a look
at it in the source for javax/swing/plaf/basic/BasicFileChooserUI.java.
Look for the class called GlobFilter. It is private, so unfortunately
you can't use it directly.
If you know exactly what you are looking for, why not just hardcode
your FileFilter like this:
public boolean accept(File f) {
    if (f != null) {
        if (f.isDirectory()) {
            return true;
        String name = f.getName();
        if (name.startsWith("tst") && name.endsWith(".jpg")) {
            return true;
    return false;
}/Leif

Similar Messages

  • File chooser to buffered image

    Hi all,
    Sorry about the total newbie question; I'm trying to figure out how to convert a jpg into a buffered image, while using the file chooser to select it. I'd like to do all this in a scrollpane. Does anyone have some sample code for this, at least so I can play around? I have ideas, but I'm getting tons of errors while trying things like:
    public class ImProc extends JComponent{
    private BufferedImage source, destination;
    private JComboBox options;
    public ImProc( BufferedImage image){
    source = destination = image;
    setBackground(Color.white);
    setLayout( new BorderLayout());
    JPanel controls = new JPanel();
    options = new JComboBox(
    new String[] {"[source]", "brighten", "darken", "rotate", "scale" }
    options.addItemListener(new ItemListener(){
    public void itemStateChanged( ItemEvent ie){
    String option = (String)options.getSelectedItem();
    BufferedImageOp op = null;
    if(option.equals("[source]"))
    destination = source;
    else if(option.equals("brighten"))
    op = new RescaleOp(1.5f, 0, null);
    else if(option.equals("darken"))
    op = new RescaleOp(0.5f, 0, null);
    else if (option.equals("rotate"))
    op = new AffineTransformOp(
    AffineTransform.getRotateInstance(Math.PI / 6), null);
    else if (option.equals("scale"))
    op = new AffineTransformOp(
    AffineTransform.getScaleInstance(.5, .5), null);
    if(op != null) destination = op.filter(source, null);
    repaint();
    controls.add(options);
    add(controls, BorderLayout.SOUTH);
    public void paintComponent(Graphics g){
    int imageWidth = destination.getWidth();
    int imageHeight = destination.getHeight();
    int width = getSize().width;
    int height = getSize().height;
    g.drawImage(destination,
    (width - imageWidth) / 2, (height - imageHeight) / 2, null);
    public static void main(String[] args){
    JFileChooser chooser = new JFileChooser();
    String filename = chooser.getName();
    ImageIcon icon = new ImageIcon(filename);
    Image i = icon.getImage();
    int w = i.getWidth(null), h = i.getHeight(null);
    BufferedImage buffImage = new BufferedImage(w, h,
    BufferedImage.TYPE_INT_RGB);
    Graphics2D imageGraphics = buffImage.createGraphics();
    imageGraphics.drawImage(i, 0, 0, null);
    JFrame frame = new JFrame("Image");
    frame.getContentPane().add(new ImProc(buffImage));
    frame.setSize(buffImage.getWidth(), buffImage.getHeight());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setVisible(true);
    So, I'm stuck. Any help from anyone is appreciated.
    Thanks,
    Joe

    Now, with:
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import java.awt.image.*;
    import javax.swing.*;
    import java.io.*;
    import javax.imageio.*;
    public class ImProc extends JComponent{
    private BufferedImage source, destination;
    private JComboBox options;
    public ImProc( BufferedImage image){
    source = destination = image;
    setBackground(Color.white);
    setLayout( new BorderLayout());
    JPanel controls = new JPanel();
    options = new JComboBox(
    new String[] {"[source]", "brighten", "darken", "rotate", "scale" }
    options.addItemListener(new ItemListener(){
    public void itemStateChanged( ItemEvent ie){
    String option = (String)options.getSelectedItem();
    BufferedImageOp op = null;
    if(option.equals("[source]"))
    destination = source;
    else if(option.equals("brighten"))
    op = new RescaleOp(1.5f, 0, null);
    else if(option.equals("darken"))
    op = new RescaleOp(0.5f, 0, null);
    else if (option.equals("rotate"))
    op = new AffineTransformOp(
    AffineTransform.getRotateInstance(Math.PI / 6), null);
    else if (option.equals("scale"))
    op = new AffineTransformOp(
    AffineTransform.getScaleInstance(.5, .5), null);
    if(op != null) destination = op.filter(source, null);
    repaint();
    controls.add(options);
    add(controls, BorderLayout.SOUTH);
    public void paintComponent(Graphics g){
    int imageWidth = destination.getWidth();
    int imageHeight = destination.getHeight();
    int width = getSize().width;
    int height = getSize().height;
    g.drawImage(destination,
    (width - imageWidth) / 2, (height - imageHeight) / 2, null);
    public static void main(String[] args){
    JFrame frame = new JFrame("Image");
    frame.setSize(300, 300);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setVisible(true);
    JFileChooser chooser = new JFileChooser();
    //String filename = chooser.getName();
    File f = chooser.getSelectedFile();
    //String filename = f.getName();
    //ImageIcon icon = new ImageIcon(filename);
    //Image i = ImageIO.read(f);
    //int w = i.getWidth(null), h = i.getHeight(null);
    //BufferedImage buffImage = null;
    try{
    BufferedImage buffImage = ImageIO.read(f);
    catch (IOException e){
    System.out.println("Error: " + e.getMessage());
    frame.getContentPane().add(new ImProc(buffImage));
    Graphics2D imageGraphics = buffImage.createGraphics();
    imageGraphics.drawImage(buffImage, 0, 0, null);
    With this, it doesn't seem to find my variable buffImage. However, it complains if I don't use the try{} catch{}. Am I not declaring something properly?

  • File chooser

    Im using file chooser to select the location and a file to save some text to, the question i need help with is can you allocation you own customer file extension to a new file ie text.kelvinstext
    thanks,
    kelvin

    Sorry if taht came across wrong it was suppose to be
    a little heart remark,No need to apologize although the thank you I'm sure is appreciated all round.
    For the most part most veterans answering questions here have pretty thick skins. We do however sometimes get frustrated when answering the same questions over and over. It's not your (ie newb / OP / not just u specifically) fault; we're just trying to train you all so that hopefully you'll be able to find your answers independently in the future.

  • File chooser Very basic

    Hey , i have a simple GUI, a button and a text box. When we click the button a file chooser will appear and we are able to select the folder/file we like.
    My question is, when we click on the button and when the File chooser window appears, i wont it to display the file structure in D:/ShanesFolder/admin/ . how do i code this.
    i ftried using
    FileFilter filter = new FileNameExtensionFilter("c files", "c"); but it filters files only.
    So how can i filter folders in the file chooser, and change the folder location to D:/ShanesFolder/admin/ instead of the default location of the file chosser.

    RTFM
    Do you see anything here that you think might be helpful? [http://java.sun.com/javase/6/docs/api/javax/swing/JFileChooser.html]

  • Combining File Chooser and this MP3 class

    Hello all,
    I was curious if anyone could help me figure out how to get a file to actually load once it is used with this code.
    I'm unfamiliar with how it works and I was hoping for an explanation on it.
    I wasn't sure if I had to have the program recgonize that I would like to load a mp3 or if it just would load it automatically...
    Essentially, I want to be able to load a mp3 if I use the file chooser.
    I can try to clarify my question more if anyone should need it.
    Thank you
    import java.io.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class List extends JPanel
                                 implements ActionListener {
        static private final String newline = "\n";
        JButton openButton, saveButton;
        JTextArea log;
        JFileChooser fc;
        public List() {
            super(new BorderLayout());
            //Create the log first, because the action listeners
            //need to refer to it.
            log = new JTextArea(5,20);
            log.setMargin(new Insets(5,5,5,5));
            log.setEditable(false);
            JScrollPane logScrollPane = new JScrollPane(log);
            //Create a file chooser
            fc = new JFileChooser();
            //Uncomment one of the following lines to try a different
            //file selection mode.  The first allows just directories
            //to be selected (and, at least in the Java look and feel,
            //shown).  The second allows both files and directories
            //to be selected.  If you leave these lines commented out,
            //then the default mode (FILES_ONLY) will be used.
            //fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
           // fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
            //Create the open button.  We use the image from the JLF
            //Graphics Repository (but we extracted it from the jar).
            openButton = new JButton("Open a File...",
                                     createImageIcon("images/Open16.gif"));
            openButton.addActionListener(this);
            //Create the save button.  We use the image from the JLF
            //Graphics Repository (but we extracted it from the jar).
            saveButton = new JButton("Save a File...",
                                     createImageIcon("images/Save16.gif"));
            saveButton.addActionListener(this);
            //For layout purposes, put the buttons in a separate panel
            JPanel buttonPanel = new JPanel(); //use FlowLayout
            buttonPanel.add(openButton);
            buttonPanel.add(saveButton);
            //Add the buttons and the log to this panel.
            add(buttonPanel, BorderLayout.PAGE_START);
            add(logScrollPane, BorderLayout.CENTER);
        public void actionPerformed(ActionEvent e) {
            //Handle open button action.
            if (e.getSource() == openButton) {
                int returnVal = fc.showOpenDialog(List.this);
                if (returnVal == JFileChooser.APPROVE_OPTION) {
                    File file = fc.getSelectedFile();
                    //This is where a real application would open the file.
                    log.append("Opening: " + file.getName() + "." + newline);
                } else {
                    log.append("Open command cancelled by user." + newline);
                log.setCaretPosition(log.getDocument().getLength());
            //Handle save button action.
            } else if (e.getSource() == saveButton) {
                int returnVal = fc.showSaveDialog(List.this);
                if (returnVal == JFileChooser.APPROVE_OPTION) {
                    File file = fc.getSelectedFile();
                    //This is where a real application would save the file.
                    log.append("Saving: " + file.getName() + "." + newline);
                } else {
                    log.append("Save command cancelled by user." + newline);
                log.setCaretPosition(log.getDocument().getLength());
        /** Returns an ImageIcon, or null if the path was invalid. */
        protected static ImageIcon createImageIcon(String path) {
            java.net.URL imgURL = List.class.getResource(path);
            if (imgURL != null) {
                return new ImageIcon(imgURL);
            } else {
                System.err.println("Couldn't find file: " + path);
                return null;
         * Create the GUI and show it.  For thread safety,
         * this method should be invoked from the
         * event-dispatching thread.
        private static void createAndShowGUI() {
            //Create and set up the window.
            JFrame frame = new JFrame("FileChooserDemo");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            //Create and set up the content pane.
            JComponent newContentPane = new List();
            newContentPane.setOpaque(true); //content panes must be opaque
            frame.setContentPane(newContentPane);
            //Display the window.
            frame.pack();
            frame.setVisible(true);
        public static void main(String[] args) {
            //Schedule a job for the event-dispatching thread:
            //creating and showing this application's GUI.
            javax.swing.SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    createAndShowGUI();
    }The mp3 class that I've been playing around with...
    import java.io.BufferedInputStream;
    import java.io.FileInputStream;
    import javazoom.jl.player.Player;
    public class MP3 {
        private String filename;
        private Player player;
        // constructor that takes the name of an MP3 file
        public MP3(String filename) {
            this.filename = filename;
        public void close() { if (player != null) player.close(); }
        // play the MP3 file to the sound card
        public void play() {
            try {
                FileInputStream fis = new FileInputStream(filename);
                BufferedInputStream bis = new BufferedInputStream(fis);
                player = new Player(bis);
            catch (Exception e) {
                System.out.println("Problem playing file " + filename);
                System.out.println(e);
            // run in new thread to play in background
            new Thread() {
                public void run() {
                    try { player.play(); }
                    catch (Exception e) { System.out.println(e); }
            }.start();
    // test client
        public static void main(String[] args) {
            String filename = "C:\\FP\\1.mp3";
            MP3 mp3 = new MP3(filename);
            mp3.play();
    }

    Thanks for the link
    I've been looking over the sections and still confused with the code.
    It's obvious that I have to do something with this portion of the code:
    public void actionPerformed(ActionEvent e) {
        //Handle open button action.
        if (e.getSource() == openButton) {
            int returnVal = fc.showOpenDialog(FileChooserDemo.this);
            if (returnVal == JFileChooser.APPROVE_OPTION) {
                File file = fc.getSelectedFile();
                //This is where a real application would open the file.
                log.append("Opening: " + file.getName() + "." + newline);
            } else {
                log.append("Open command cancelled by user." + newline);
    }I'm just not sure what.

  • Gnome 3.16 file chooser dialog

    I have some questions about the file chooser dialog in Gnome 3.16
    I see at the gnome site that it states there is now a search button in the file chooser dialog. I see that.
    https://help.gnome.org/misc/release-not … re.html.en
    However, it used to be possible that when this dialog was open, you could type in the file/directory list to quickly take you to a folder or file. This does not seem to work any more... It still works in Thunderbird for example when attaching a file (different dialog box, I know)
    For example, if you had three folders in the open or save dialog of gedit or eog
    alpha
    bravo
    charlie
    If you typed "c", it would select the charlie folder.
    Was it intentional that this possibility be removed? Does anyone else see what I see?
    Thanks

    w201 wrote:Dconf editor has completly vanished from my activities overview, well at least the GUI frontend, pacman shows that it's installed. Another function that seems to be gone in 3.16 is the ability to search for files from the activities overview!! I really hope that gets fixed soon :-(
    reinstalling dconf-editor fixed that issue for me

  • Custom file chooser or color chooser?

    Hello
    Can I change standard text appearing panels of file chooser or color chooser or change icons in file chooser?.
    Cheers

    In the future, Swing related questions should be posted in the Swing forum.
    The [url http://java.sun.com/docs/books/tutorial/uiswing/TOC.html]Swing Tutorial has sections on using a Color Chooser and File Chooser.

  • File Chooser + Loops

    I've been at this sadly for almost 8 hours now....here is what my program is suppose to accomplish....yet it's not and I cannot for the life of me figure out what to do
    1. Prompt the user to browse to a file.
    If the user browses to a file, selects it and hits open it will open a JTextArea displaying the text within the file. When the JTextArea closes the program should terminate.
    2. When the user is prompted and selects CANCEL a "catch" statement should then throw a pop-up window telling the user they they did not select a file. When they aknowledge the pop-up they should be prompted to browse to a file. If they continue to hit cancel it should continue to run them through the loop. HOWEVER, when they finally browse and select a file it should work just as I stated in #1.
    3. The same explaination as #2 goes for the catch statement when a users file is unable to be found.
    I have exhausted all online resources, my book, my teacher to try and find how to properly formulate my code and loop to work correctly. This is the best I have come up with.
    It does everything except for one major problem. When a user finally does select a file after running through the loop, it will not display anything.
    Someone please...break this down for me or even edit my code so that I can visually see what and where things go.....I know the reason nothing is being displayed is because in the catch statement I am not stating what to do after the user selects a file....but I dont even think i'm doing this right....sigh
    //  DisplayFile.java       Author: Lewis/Loftus
    //  Demonstrates the use of a file chooser and a text area.
    import java.util.Scanner;
    import java.io.*;
    import javax.swing.*;
    public class FileDisplay
       public static void main (String[] args) throws IOException
          JFrame frame = new JFrame ("Display File");
          frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
          JTextArea ta = new JTextArea (20, 30);
          JFileChooser chooser = new JFileChooser();
          int status = chooser.showOpenDialog (null);
         do
             try {
                File  file = chooser.getSelectedFile();
                Scanner scan = new Scanner(file);
                String info = "";
                while (scan.hasNext())
                info +=scan.NextLine() + "\n";
                 ta.setText (info);
              catch (FileNotFoundException exception)
                   JOptionPane.showMessageDialog (null, "File could not be found, click ok to try again");
    chooser.showOpenDialog (null);
              catch (NullPointerException exception)
                   JOptionPane.showMessageDialog (null, "You did not choose a file, click ok to try again");
    chooser.showOpenDialog (null);
         } while (status !=JFileChooser.APPROVE_OPTION);
          frame.getContentPane().add (ta);
          frame.pack();
          frame.setVisible(true);
    }

    No. That's not an assignment statement. To change the value of the variable "status", you need an assignment statement. If being told that isn't helpful, then I suggest you go and talk to your teacher. You won't be able to get anywhere here by asking questions like that.

  • I got new hard driver for my MacBook I don't have the cd but I do have flash drive that has the software I need help because when I turn on my laptop it shows me a file with question mark how can I install the software from the flash driver?

    I got new hard driver for my MacBook I don't have the cd but I do have flash drive that has the software I need help because when I turn on my laptop it shows me a file with question mark how can I install the software from the flash driver?

    Hold down the Option key while you boot your Mac. Then, it should show you a selection of devices. Click your flash drive and it will boot from that.

  • How to find if the user has selected one or many files using a file chooser

    I have a file chooser but want it to return either a file or file array depending on whether more than one file is selected but there doesn't seem to be any way to find out if that is the case or not. I want it to look something like:
                if(fileChooser.getSelectedFile().isDirectory()==true)
                    selectedFile=fileChooser.getCurrentDirectory();
                else if(fileChooser.multipleFilesSelected())
                    fileChooser.getSelectedFiles();//we have more than one file selected
                else   
                    fileChooser.getSelectedFile();    //if we have one file selected
                }am I going about dealing with this in the right way?

    OK, I scoured the API again and found I could avoid the problem altogether by using
    http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JFileChooser.html#isMultiSelectionEnabled()
    and
    http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JFileChooser.html#setFileSelectionMode(int)

  • Need help adding a default file name in a file chooser of save dialog type

    I need to create a file chooser with save dialog type, how can I add a highlighted default file name into the File Name textfield? As in Microsoft Word, when you want to save a document, a default file name Doc1.doc will appear in the File name text field of the file chooser even when you change to other directories.

    For JRE 1.4.0 you can use this fix:
    public class FileChooserFix implements PropertyChangeListener {
      private String fileName;
       * @see PropertyChangeListener
      public void propertyChange(PropertyChangeEvent ev) {
        JFileChooser chooser = (JFileChooser)ev.getSource();
        if (JFileChooser.FILES_ONLY == chooser.getFileSelectionMode()) {
          if (JFileChooser.SELECTED_FILE_CHANGED_PROPERTY.equals(ev.getPropertyName())) {
            File selectedFile = (File)ev.getNewValue();
            if (selectedFile != null) {
              // remember fileName of selected file
              fileName = selectedFile.getName();
          if (fileName != null &&
              JFileChooser.DIRECTORY_CHANGED_PROPERTY.equals(ev.getPropertyName())) {
            // reset selected file
            File directory = (File)ev.getNewValue();
            chooser.setSelectedFile(new File(directory, fileName));
       * Convenience method to create a fixed file chooser.
       * @return      fixed file chooser
      public static JFileChooser create() {
        JFileChooser chooser = new JFileChooser();
        chooser.addPropertyChangeListener(new FileChooserFix());
        return chooser;

  • Default settings for File Chooser dialog

    I reach the file chooser dialog by selecting File-Open File.
    Under the toolbar-options menu in the Open File Dialog, I can select to have a bookmark icon appear on the toolbar.
    How do I set a default to have the Bookmark icon always appear?
    Firefox 11 on openSuSE 12.1

    I don't think so, if I hide the Menu bar I don't see a Bookmarks Menu.
    In this picture http://dl.dropbox.com/u/50261731/Open_File%20Menu%20.png an arrow points to an Options menu button. Select that Button and a list of options opens, one of which is "Show Bookmarks". I would like the Show Bookmarks option to be "ON" by default.
    Be aware that I am running SuSE 12.1 and I believe this Menu is provided by KDE integration "kmozillahelper", so my menu may be different from the default Firefox menu.

  • Custom file chooser

    Hello,
    I need to design a custom file chooser. Infact, I cannot call it a file
    chooser, because this is not accessing local system files. I am uploading
    some files into a directory using ASP and I keep that file name in the database.
    I can even upload directores and directores with files too into the database.
    I need to display those files and folders in the "what is called as file chooser".
    The List should work as it works in file chooser. i.e when I click on a folder,
    it should show the files inside it. When I click on the file, the file should
    be selected. Infact there is nothing in the file. Its all virtual only. Its only
    the name that is selected.
    I should be given an option to select "directories only" also.
    The "file chooser" should not have show files of type, just the file name
    text field only. The combobox should display "user added" string message. And
    this is only one item in the combobox. I should be able to create folders, show
    lists,etc... as it appears in the file chooser. (buttons beside the combobox)
    Any ideas would be greatly appreciated.
    Thanks

    ok, this is just an example....you'll probably need a different constructor and additional methods....
    public class VirtualFile{
      private String file ;
      private VirtualFile[] children;
      private VirtualFile parent;
      public VirtualFile(String file,VirtualFile parent,VirtualFiles[]children){
         this.file = file;
         this.parent = parent;
         this.children = children;
      public boolean isRoot(){
        return parent == null;
      public boolean isDirectory(){
        return children = null || children.length==0;
      public VirtualFile[] getChildren){
        return children;
    }

  • File Chooser in a Panel - please help

    Hello!
    I am implementing a FTP program as part of an assignment. Can you please tell me how I can get a File Chooser like interface to the files on the remote computer? Can the existing JFileChooser be modified to support this and also can it be embedded in a panel rather than opening in a separate dialog box? Is there any way to get drag and drop support in it?
    Please do help
    Thanks
    Dilip

    Hi!
    Actually, you can use JFileChooser for remote filesystems. I've implemented it once using JDK 1.3.1 (accessing a remote Linux machine over RMI in an applet):
    (1) Create your own subclass of java.io.File, hooking all methods that actually access the filesystem (isDirectory, getSize, ...) to your ftp-connection. (That's the main work, about 50 methods to overwrite, but you can skip many, e.g. createTemporaryFile).
    (2) Make your own subclass of FileSystemView to deliver objects of your File-class instead of Sun's.
    (3) Initialize JFileChooser with this FileSystemView.
    You may also take a look at
    http://www.crocodile.org/listok/2/WhatDoesFileSystemViewView.shtml .

  • File file chooser

    Hi.
    I have a JFrame (main frame), that opens another JFrame (popup frame) when u click a button, and in this frame I have a file chooser. The problem is, when i open the file chooser, the popup frame closes (shuts down) while the main frame stais put. How can i prevent the popup frame from closing when clicking the file chooser button?
    here's the code for the file chooser:
    FileChooser fc = new FileChooser();
    int returnVal = fc.showOpenDialog(this);
    if (returnVal == JFileChooser.APPROVE_OPTION)
    File file = fc.getSelectedFile();
    String fileName = file.getName();
    JDialog chooseFileFrame = new JDialog();
    Container content2 = chooseFileFrame.getContentPane();
    content2.show();

    Nope. both main frame and popup frame are JFrames. Here's the rest of the code:
    I have a JFrame, fullcreen, contains a button Button_popup, that calls a new JFrame:
    //call file chooser button
    JButton chooseFileButton = new JButton("choose file");
    //popup frame (that closes when i opens the file chooser
    JFrame popUp= new JFrame("Heading");
    popUp.setUndecorated(true);
    popUp.getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
    popUp.setBounds(0,0,600,500);
    Container content = popUp.getContentPane();
    content.setBackground(Color.white);
    content.add(chooseFileButton);
    adds the file chooser button to my action listener, if hit:
    private void chooseFile()
    if (returnVal == JFileChooser.APPROVE_OPTION)
    File file = fc.getSelectedFile();
    String file= file.getName();
    JDialog fileChooserDialog= new JDialog();
    Container content = fileChooserDialog.getContentPane();
    content.show();
    }

Maybe you are looking for

  • Urgent.. Making efficient editor

    Hello java gurus, Presently Iam building my own editor for a new language.I want to make this an efficient editor. By an efficient editor i mean that when a very big file is opened into it, the whole file should not be there in the memory.I want only

  • How to generate a set of date type records

    How to generate a set of date-type records, with a fixed interval, starting from a date like 2008-01-01.

  • WBS element groups

    hello In PS are transactions CJSG, KJH2, KJH3 to generate, edit and view WBS element groups. Ok I can add many different WBS elements to my group. But I have one question. Which parameters should I change in config or in other place to get possiblity

  • Chart Display

    Hi Friends, I am facing problem with the chart. Problem: If data is small then chart is displaying fine but if data is huge, chart was disappering. Can anybody fix this issue.I am using BI7 Regards Madhu

  • Three external SWF's - not smooth. Fla included

    Hey geniuses. I have a main Flash movie that preloads three external SWF's just perfectly.  Everything is great...except the 1st movie is not smooth and really slow, the 2nd movie is a little better, and the third movie is the best. You can see what