Package javax.swing

Examples of javax.swing.JFileChooser$WeakPCL


class TemplateOptions extends OptionsPanel {
  private class MyListener implements ActionListener, PropertyChangeListener {
    public void actionPerformed(ActionEvent event) {
      Object src = event.getSource();
      if (src == templateButton) {
        JFileChooser chooser = JFileChoosers.create();
        chooser.setDialogTitle(Strings.get("selectDialogTitle"));
        chooser.setApproveButtonText(Strings.get("selectDialogButton"));
        int action = chooser.showOpenDialog(getPreferencesFrame());
        if (action == JFileChooser.APPROVE_OPTION) {
          File file = chooser.getSelectedFile();
          FileInputStream reader = null;
          InputStream reader2 = null;
          try {
            Loader loader = new Loader(getPreferencesFrame());
            reader = new FileInputStream(file);
View Full Code Here


      return;
    }
   
    // Then display file chooser
    Loader loader = proj.getLogisimFile().getLoader();
    JFileChooser chooser = loader.createChooser();
    if (circuits.size() > 1) {
      chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
      chooser.setDialogTitle(Strings.get("exportImageDirectorySelect"));
    } else {
      chooser.setFileFilter(filter);
      chooser.setDialogTitle(Strings.get("exportImageFileSelect"));
    }
    int returnVal = chooser.showDialog(frame, Strings.get("exportImageButton"));
    if (returnVal != JFileChooser.APPROVE_OPTION) return;

    // Determine whether destination is valid
    File dest = chooser.getSelectedFile();
    chooser.setCurrentDirectory(dest.isDirectory() ? dest : dest.getParentFile());
    if (dest.exists()) {
      if (!dest.isDirectory()) {
        int confirm = JOptionPane.showConfirmDialog(proj.getFrame(),
          Strings.get("confirmOverwriteMessage"),
          Strings.get("confirmOverwriteTitle"),
View Full Code Here

 
  public static JFileChooser createSelected(File selected) {
    if (selected == null) {
      return create();
    } else {
      JFileChooser ret = createAt(selected.getParentFile());
      ret.setSelectedFile(selected);
      return ret;
    }
  }
View Full Code Here

      s.getContents().clear();
    }
  }

  private void doLoad() {
    JFileChooser chooser = proj.createChooser();
    File oldSelected = factory.getCurrentImage(instance);
    if (oldSelected != null) chooser.setSelectedFile(oldSelected);
    chooser.setDialogTitle(Strings.get("ramLoadDialogTitle"));
    int choice = chooser.showOpenDialog(frame);
    if (choice == JFileChooser.APPROVE_OPTION) {
      File f = chooser.getSelectedFile();
      try {
        factory.loadImage(circState.getInstanceState(instance), f);
      } catch (IOException e) {
        JOptionPane.showMessageDialog(frame, e.getMessage(),
            Strings.get("ramLoadErrorTitle"), JOptionPane.ERROR_MESSAGE);
View Full Code Here

  }

  private void doSave() {
    MemState s = factory.getState(instance, circState);

    JFileChooser chooser = proj.createChooser();
    File oldSelected = factory.getCurrentImage(instance);
    if (oldSelected != null) chooser.setSelectedFile(oldSelected);
    chooser.setDialogTitle(Strings.get("ramSaveDialogTitle"));
    int choice = chooser.showSaveDialog(frame);
    if (choice == JFileChooser.APPROVE_OPTION) {
      File f = chooser.getSelectedFile();
      try {
        HexFile.save(f, s.getContents());
        factory.setCurrentImage(instance, f);
      } catch (IOException e) {
        JOptionPane.showMessageDialog(frame, e.getMessage(),
View Full Code Here

   * @return selected File
   * @param programs
   *          programs that are exported
   */
  private File chooseFile(Program[] programs) {
    JFileChooser select = new JFileChooser();

    ExtensionFileFilter vCal = new ExtensionFileFilter(mExtension,
        mExtensionFilter);
    select.addChoosableFileFilter(vCal);
    String ext = "." + mExtension;

    if (mSavePath != null) {
      select.setSelectedFile(new File(mSavePath));
      select.setFileFilter(vCal);
    }

    // check if all programs have same title. if so, use as filename
    String fileName = programs[0].getTitle();
    for (int i = 1; i < programs.length; i++) {
      if (!programs[i].getTitle().equals(fileName)) {
        fileName = "";
      }
    }

    fileName = CalendarToolbox.cleanFilename(fileName);

    if (StringUtils.isNotEmpty(fileName)) {
      if (mSavePath == null) {
        mSavePath = "";
      }
      select.setSelectedFile(new File((new File(mSavePath).getParent())
          + File.separator + fileName + ext));
    }

    if (select.showSaveDialog(CalendarExportPlugin.getInstance()
        .getBestParentFrame()) == JFileChooser.APPROVE_OPTION) {

      String filename = select.getSelectedFile().getAbsolutePath();

      if (!filename.toLowerCase().endsWith(ext)) {
        if (filename.endsWith(".")) {
          filename = filename.substring(0, filename.length() - 1);
        }
View Full Code Here

 
  /**
   * Call the FileChooser for the executable
   */
  private void changeFile() {
    JFileChooser chooser = new JFileChooser(new File(mFile.getText()));
    if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
      mFile.setText(chooser.getSelectedFile().getAbsolutePath());
    }
  }
View Full Code Here

   
    /**
     * invoked when the user clicks the Button to open an FileChooser - Dialog
     */
    private void pathButtonPressed(ActionEvent e) {
        JFileChooser f = new JFileChooser();
        if (f.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
            mData.setProgramPath(f.getSelectedFile().toString());
            mPathTextField.setText(mData.getProgramPath());
        }
    }
View Full Code Here

    rootpathField.setColumns(10);
   
    JButton selectRootPathButton = new JButton("\u9009\u62E9");
    selectRootPathButton.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        JFileChooser jfc = new JFileChooser();
        jfc.setName("请选择本地存放文件夹");
        jfc.setDialogTitle("请选择本地存放文件夹");
        jfc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
        int rc = jfc.showOpenDialog(frmEverbox);
        if(rc == JFileChooser.APPROVE_OPTION )
          rootpathField.setText(jfc.getSelectedFile().getAbsolutePath());
      }
    });
    sl_panel.putConstraint(SpringLayout.NORTH, selectRootPathButton, -4, SpringLayout.NORTH, label_3);
    sl_panel.putConstraint(SpringLayout.WEST, selectRootPathButton, 6, SpringLayout.EAST, rootpathField);
    panel.add(selectRootPathButton);
View Full Code Here

    reminderWindowCfg.add(mReminderWindowChB, cc.xyw(1,1,2));
    reminderWindowCfg.add(mShowAlwaysOnTop, cc.xy(2,3));
       
    mSoundFileChB = new FileCheckBox(mLocalizer.msg("playlingSound", "Play sound"), new File(soundFName), 0, false);
   
    JFileChooser soundChooser=new JFileChooser((String)null);
    soundChooser.setFileFilter(new ExtensionFileFilter(extArr, msg));

    mSoundFileChB.setFileChooser(soundChooser);
       
    mSoundFileChB.setSelected(mSettings.getProperty("usesound","false").equals("true"));
   
View Full Code Here

TOP

Related Classes of javax.swing.JFileChooser$WeakPCL

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.