Package charvax.swing

Examples of charvax.swing.JFileChooser$ChooserDialog


    /**
     * Demonstrate the JFileChooser.
     */
    private void testFileChooser() {
        JFileChooser chooser = new JFileChooser();
        chooser.setDialogTitle("A File Chooser");
        chooser.setForeground(Color.white);
        chooser.setBackground(Color.blue);
        chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);

        //  Uncomment this section of code to apply a FileFilter that masks out
        // all
        //  files whose names do not end with ".java".
        //  /* Construct an anonymous inner class that extends the abstract
        //   * FileFilter class.
        //   */
        //  charvax.swing.filechooser.FileFilter filter =
        //    new charvax.swing.filechooser.FileFilter() {
        //      public boolean accept(File file_) {
        //    String pathname = file_.getAbsolutePath();
        //    return (pathname.endsWith(".java"));
        //      }
        //  };
        //  chooser.setFileFilter(filter);

        if (chooser.showDialog(this, "Open File") == JFileChooser.APPROVE_OPTION) {

            String msgs[] = { "The selected file was:",
                    chooser.getSelectedFile().getAbsolutePath()};
            JOptionPane.showMessageDialog(this, msgs,
                    "Results of JFileChooser", JOptionPane.PLAIN_MESSAGE);
        } else {
            JOptionPane.showMessageDialog(this,
                    "The CANCEL button was selected",
View Full Code Here


        }
    }

    private void initFileChooser() {
        if (fc == null) {
            fc = new JFileChooser(directory);
            fc.setBackground(Color.cyan);
            fc.setForeground(Color.black);
            fc.setFileSelectionMode(ListSelectionModel.SINGLE_SELECTION);
            fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
        }
View Full Code Here

TOP

Related Classes of charvax.swing.JFileChooser$ChooserDialog

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.