Package javax.swing

Examples of javax.swing.JFileChooser


        this.setBorder(BorderFactory.createEtchedBorder());// TODO i18n
        bChoose = new JButton("Choose..."); // TODO i18n
        bChoose.addActionListener(this);
       
        if (fileChooser == null) {
            fileChooser = new JFileChooser();
            // Add a custom file filter and disable the default
            // (Accept All) file filter.
            fileChooser.addChoosableFileFilter(new ImageMapper.ImageFileFilter());
            fileChooser.setAcceptAllFileFilterUsed(false);
            // Add the preview pane.
View Full Code Here


   * Chooses the browser.
   *
   * @throws RegainException If saving the config failed.
   */
  private void chooseBrowser() throws RegainException {
    JFileChooser fileChooser = new JFileChooser();
   
    String msg = mLocalizer.msg("chooseBrowser", "Choose browser");
    fileChooser.setDialogTitle(msg);
    fileChooser.showOpenDialog(mFrame);

    File file = fileChooser.getSelectedFile();
    if (file != null) {
      Document desktopDoc = XmlToolkit.loadXmlDocument(DESKTOP_CONFIG_FILE);
      Element desktopConfig = desktopDoc.getDocumentElement();

      // Set the browser
View Full Code Here

        destinationPanel.add(destinationTextField);

        // BROWSE_BUTTON
        browseButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                JFileChooser fileChooser = SharedJFileChooser.getInstance(SharedJFileChooserType.PDF_FILE,
                        JFileChooser.FILES_ONLY, destinationTextField.getText());
                if (fileChooser.showOpenDialog(browseButton.getParent()) == JFileChooser.APPROVE_OPTION) {
                    File chosenFile = fileChooser.getSelectedFile();
                    if (chosenFile != null) {
                        destinationTextField.setText(chosenFile.getAbsolutePath());
                    }
                }
            }
View Full Code Here

  }

  private void showOpenFileDialog(
    )
  {
    JFileChooser fileChooser = new JFileChooser(
      inputPath + java.io.File.separator + "pdf"
      );
    fileChooser.setDialogTitle("Open PDF file");
    fileChooser.addChoosableFileFilter(new PdfFileFilter());
    switch(fileChooser.showDialog(null, "Open"))
    {
      case JFileChooser.APPROVE_OPTION:
        File file = fileChooser.getSelectedFile();

        domInspector.open(file);
        break;
    }
  }
View Full Code Here

        add(buttonBrowse, gridBagConstraints);

    }// </editor-fold>//GEN-END:initComponents

    private void buttonBrowseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonBrowseActionPerformed
        final JFileChooser chooser = new JFileChooser();
        if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION)
        {
            try {
                textFile.setText(chooser.getSelectedFile().getCanonicalPath());
            } catch (IOException ex) {
                ErrorDialog.showError(this, ex);
            }
        }
    }//GEN-LAST:event_buttonBrowseActionPerformed
View Full Code Here

    }
     
    }//GEN-LAST:event_buttonChooseCaptureDeviceActionPerformed

    private void buttonBrowseFileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonBrowseFileActionPerformed
    final JFileChooser chooser = new JFileChooser();
    if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION)
    {
      final String path = URLUtils.createUrlStr(chooser.getSelectedFile());
      textFieldURL.setText(path);
    }
    }//GEN-LAST:event_buttonBrowseFileActionPerformed
View Full Code Here


    /** debug - parse the atom chosen by user
     */
    public static void main (String[] args) {
        JFileChooser chooser = new JFileChooser ();
        int response = chooser.showOpenDialog(null);
        if (response == JFileChooser.CANCEL_OPTION)
            return;
        File f = chooser.getSelectedFile();
        try {
            ParsedAtom[] atomTree = parseAtoms (f);
            printAtomTree (atomTree, "");
        } catch (IOException ioe) {
            ioe.printStackTrace();
View Full Code Here

 
    class OpenItemListener implements ActionListener {
  public void actionPerformed(ActionEvent e) {
      File mediaFile = null;

      JFileChooser chooser = new JFileChooser(getChooserRoot());
      chooser.addChoosableFileFilter(new MixFileFilter());

      int rc = chooser.showOpenDialog(SimpleMixer.this);

      if (rc == JFileChooser.APPROVE_OPTION) {
    mediaFile = chooser.getSelectedFile();
    if (mediaFile != null) {
        MediaLocator ml = null;
        String filePath = null
        try {
      filePath = mediaFile.getCanonicalPath();
View Full Code Here

    // Save track info to a MIX file
    //
    class SaveItemListener implements ActionListener {
  public void actionPerformed(ActionEvent e) {
      File trackFile = null;
      JFileChooser chooser = new JFileChooser(getChooserRoot());
      chooser.addChoosableFileFilter(new MixFileFilter());
      chooser.addChoosableFileFilter(new HTMLFileFilter());

      int rc = chooser.showSaveDialog(SimpleMixer.this);

      if (rc == JFileChooser.APPROVE_OPTION) {
    trackFile = chooser.getSelectedFile();
    FileFilter ff = chooser.getFileFilter();
    if (ff instanceof ExtensionFilter) {
        ExtensionFilter xff =
            (ExtensionFilter) chooser.getFileFilter();
              trackModel.write(xff, trackFile);
    } else { // generate default MIX file
        trackModel.write(new MixFileFilter(), trackFile);
    }
      }
View Full Code Here

    // Load  track info from a MIX file using JFileChooser
    //
    class LoadItemListener implements ActionListener {
  public void actionPerformed(ActionEvent e) {
      File trackFile = null;
      JFileChooser chooser = new JFileChooser(getChooserRoot());
      chooser.addChoosableFileFilter(new MixFileFilter());

      int rc = chooser.showDialog(SimpleMixer.this, "Load");

      if (rc == JFileChooser.APPROVE_OPTION) {
    trackFile = chooser.getSelectedFile();
    if (trackFile == null)
        return;

    trackModel.clear();
    rc = trackModel.read(trackFile);
View Full Code Here

TOP

Related Classes of javax.swing.JFileChooser

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.