Examples of JFileDialog


Examples of chrriis.dj.nativeswing.swtimpl.components.JFileDialog

    cons.gridy++;
    final JButton showDialogButton = new JButton("Show Dialog");
    showDialogButton.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        if(basicRadioButton.isSelected()) {
          JFileDialog fileDialog = new JFileDialog();
          fileDialog.show(contentPane);
          JOptionPane.showMessageDialog(contentPane, "Selected file: " + fileDialog.getSelectedFileName());
          return;
        }
        if(multiSelectionRadioButton.isSelected()) {
          JFileDialog fileDialog = new JFileDialog();
          fileDialog.setSelectionMode(SelectionMode.MULTIPLE_SELECTION);
          fileDialog.show(contentPane);
          String fileNames = Arrays.toString(fileDialog.getSelectedFileNames());
          if(fileNames.length() > 100) {
            fileNames = fileNames.substring(0, 100) + "...";
          }
          JOptionPane.showMessageDialog(contentPane, "Selected files: " + fileNames);
          return;
        }
        if(filtersRadioButton.isSelected()) {
          JFileDialog fileDialog = new JFileDialog();
          fileDialog.setDialogType(DialogType.SAVE_DIALOG_TYPE);
          fileDialog.setExtensionFilters(new String[] {"*.*", "*.mp3;*.avi", "*.txt;*.doc"}, new String[] {"All files", "Multimedia file (*.mp3, *.avi)", "Text document (*.txt, *.doc)"}, 1);
          fileDialog.setConfirmedOverwrite(true);
          fileDialog.show(contentPane);
          JOptionPane.showMessageDialog(contentPane, "Selected file: " + fileDialog.getSelectedFileName());
          return;
        }
        if(directoryRadioButton.isSelected()) {
          JDirectoryDialog directoryDialog = new JDirectoryDialog();
          directoryDialog.show(contentPane);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.