Package javax.swing.filechooser

Examples of javax.swing.filechooser.FileNameExtensionFilter


    return true;
  }

  private String getFileNameForSaving() {
    JFileChooser jfc = new JFileChooser();
    FileNameExtensionFilter filter = new FileNameExtensionFilter(
        "Color scheme files", "colorschemes");
    jfc.setFileFilter(filter);
    int returnVal = jfc.showSaveDialog(SwingUtilities
        .getWindowAncestor(this));
    if (returnVal == JFileChooser.APPROVE_OPTION) {
View Full Code Here


    String path = "";

    fc = new JFileChooser();
    fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
    fc.setFileFilter(new FileNameExtensionFilter(null, Filer.FILE_EXT));
    int returnVal = fc.showSaveDialog(framer);

    if (returnVal == JFileChooser.APPROVE_OPTION) {
      File file = fc.getSelectedFile();
     
View Full Code Here

   
    String path = "";

    fc = new JFileChooser();
    fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
    fc.setFileFilter(new FileNameExtensionFilter(null, Filer.FILE_EXT));
    int returnVal = fc.showOpenDialog(framer);

    if (returnVal == JFileChooser.APPROVE_OPTION) {
      File file = fc.getSelectedFile();
      path = file.getAbsolutePath();
View Full Code Here

    String path = "";

    fc = new JFileChooser();
    fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
    fc.setFileFilter(new FileNameExtensionFilter(null, Filer.FILE_EXT));
    int returnVal = fc.showSaveDialog(framer);

    if (returnVal == JFileChooser.APPROVE_OPTION) {
      File file = fc.getSelectedFile();
     
View Full Code Here

  }
 
  public void importDeck(){
    fc = new JFileChooser();
    fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
    fc.setFileFilter(new FileNameExtensionFilter(null, Filer.FILE_EXT));
    fc.setMultiSelectionEnabled(true);
    int returnVal = fc.showOpenDialog(framer);

    if (returnVal == JFileChooser.APPROVE_OPTION) {
      File[] files = fc.getSelectedFiles();
View Full Code Here

    public void mouseReleased( MouseEvent mevt){
      ((JLabel) mevt.getComponent()).setBorder(new BevelBorder(BevelBorder.RAISED));
    }
    public void mouseClicked( MouseEvent mevt){
      JFileChooser chooser = new JFileChooser("src/");
      FileNameExtensionFilter filter = new FileNameExtensionFilter(
          "IEC61499 Function Block (.fbt)", "fbt");
      chooser.setFileFilter(filter);
      int returnVal = chooser.showOpenDialog(me);

      if(returnVal == JFileChooser.APPROVE_OPTION) {
View Full Code Here

      public void actionPerformed(ActionEvent e) {
        JFileChooser jfc = new JFileChooser();
        jfc.setDialogTitle("Abrir...");
        jfc.setDialogType(JFileChooser.OPEN_DIALOG);

        FileNameExtensionFilter fileNameExtensionFilter = new FileNameExtensionFilter(
            "Arquivos BDF", ApplicationController.EXTENSAO);
        jfc.addChoosableFileFilter(fileNameExtensionFilter);

        if (jfc.showDialog(null, "Abrir") == JFileChooser.APPROVE_OPTION) {
          if (!controller.isNomeArquivoValido(jfc.getSelectedFile()
              .getName())) {
            JOptionPane.showMessageDialog(ViewFrame2.this,
                "Arquivo inv�lido!", "Erro",
                JOptionPane.ERROR_MESSAGE);
          } else {
            try {

              controller.abrir(jfc.getSelectedFile().getAbsolutePath(), jfc.getSelectedFile().getName());
              jTextAreaEditor.setText(controller.getCodigo());
              jTextAreaConsole.setText("");
              modificou(Status.UNMODIFIED);
            } catch (Exception e1) {
              JOptionPane.showMessageDialog(ViewFrame2.this, e1
                  .getMessage(), "Erro",
                  JOptionPane.ERROR_MESSAGE);
              e1.printStackTrace();
            }
          }

        }
      }
    });

    jButtonSalvar.addActionListener(new ActionListener() {

      @Override
      public void actionPerformed(ActionEvent e) {
        if (controller.isNovo()) {
          final JFileChooser jfc = new JFileChooser();
          jfc.setDialogTitle("Salvar...");
          jfc.setDialogType(JFileChooser.SAVE_DIALOG);

          FileNameExtensionFilter fileNameExtensionFilter = new FileNameExtensionFilter(
              "Arquivos BDF", ApplicationController.EXTENSAO);
          jfc.addChoosableFileFilter(fileNameExtensionFilter);

          if (jfc.showDialog(ViewFrame2.this, "Salvar") == JFileChooser.APPROVE_OPTION) {
            if (jfc.getFileFilter() == fileNameExtensionFilter) {
View Full Code Here

   * Exports graphics as SVG.
   */
  public void exportGfx() {
    JFileChooser fileChooser = new JFileChooser();
    fileChooser.setDialogTitle(getResourceString("dialog.exportgfx.title"));
    FileNameExtensionFilter svgFilter = new FileNameExtensionFilter(
      "Scalable Vector Graphics file (*.svg)", "svg");
    FileNameExtensionFilter pngFilter = new FileNameExtensionFilter(
      "Portable Network Graphics file (*.png)", "png");
    fileChooser.addChoosableFileFilter(svgFilter);
    fileChooser.addChoosableFileFilter(pngFilter);
    fileChooser.setAcceptAllFileFilterUsed(false);
    if (fileChooser.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) {
View Full Code Here

  /**
   * Returns the FileFilter for the TinyUML serialized model files.
   * @return the FileFilter
   */
  private FileNameExtensionFilter createModelFileFilter() {
    return new FileNameExtensionFilter(
      "TinyUML serialized model file (*.tsm)", "tsm");
  }
View Full Code Here

   * Exports graphics as SVG.
   */
  private void exportGfx() {
    JFileChooser fileChooser = new JFileChooser();
    fileChooser.setDialogTitle(getResourceString("dialog.exportgfx.title"));
    FileNameExtensionFilter svgFilter = new FileNameExtensionFilter(
      "Scalable Vector Graphics file (*.svg)", "svg");
    FileNameExtensionFilter pngFilter = new FileNameExtensionFilter(
      "Portable Network Graphics file (*.png)", "png");
    fileChooser.addChoosableFileFilter(svgFilter);
    fileChooser.addChoosableFileFilter(pngFilter);
    fileChooser.setAcceptAllFileFilterUsed(false);
    if (fileChooser.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) {
View Full Code Here

TOP

Related Classes of javax.swing.filechooser.FileNameExtensionFilter

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.