List of usage examples for javax.swing JFileChooser FILES_AND_DIRECTORIES
int FILES_AND_DIRECTORIES
To view the source code for javax.swing JFileChooser FILES_AND_DIRECTORIES.
Click Source Link
From source file:wsattacker.sso.openid.attacker.gui.MainGui.java
/** * This method is called from within the constructor to * initialize the form./*from w ww. j av a 2 s .c o m*/ * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { bindingGroup = new BindingGroup(); saveFileChooser = new JFileChooser(); loadFileChooser = new JFileChooser(); xmlFileFilter = new XmlFileFilter(); controller = new ServerController(); serverStatusToIconConverter = new ServerStatusToIconConverter(); splitPane = new JSplitPane(); jXTaskPaneContainer1 = new JXTaskPaneContainer(); attackerIdpTaskPane = new JXTaskPane(); analyzerIdpTaskPane = new JXTaskPane(); evaluationTaskPane = new JXTaskPane(); logTaskPane = new JXTaskPane(); menuBar = new JMenuBar(); fileMenu = new JMenu(); saveItem = new JMenuItem(); loadItem = new JMenuItem(); jSeparator2 = new JPopupMenu.Separator(); clearLogMenuItem = new JMenuItem(); jSeparator1 = new JPopupMenu.Separator(); exitNoConfigSave = new JMenuItem(); exitAndSaveConfig = new JMenuItem(); saveFileChooser.setDialogType(JFileChooser.SAVE_DIALOG); saveFileChooser.setFileFilter(xmlFileFilter); loadFileChooser.setFileFilter(xmlFileFilter); loadFileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); addWindowListener(new WindowAdapter() { public void windowOpened(WindowEvent evt) { formWindowOpened(evt); } public void windowClosing(WindowEvent evt) { formWindowClosing(evt); } }); splitPane.setBorder(null); splitPane.setDividerLocation(200); splitPane.setDividerSize(0); jXTaskPaneContainer1.setMinimumSize(new Dimension(200, 259)); jXTaskPaneContainer1.setPreferredSize(new Dimension(200, 10)); VerticalLayout verticalLayout1 = new VerticalLayout(); verticalLayout1.setGap(14); jXTaskPaneContainer1.setLayout(verticalLayout1); attackerIdpTaskPane.setFocusable(false); attackerIdpTaskPane.setTitle("Attacker IdP"); Binding binding = Bindings.createAutoBinding(AutoBinding.UpdateStrategy.READ_WRITE, controller, ELProperty.create("${attackerServer.status}"), attackerIdpTaskPane, BeanProperty.create("icon")); binding.setConverter(serverStatusToIconConverter); bindingGroup.addBinding(binding); jXTaskPaneContainer1.add(attackerIdpTaskPane); analyzerIdpTaskPane.setFocusable(false); analyzerIdpTaskPane.setTitle("Analyzer IdP"); binding = Bindings.createAutoBinding(AutoBinding.UpdateStrategy.READ_WRITE, controller, ELProperty.create("${analyzerServer.status}"), analyzerIdpTaskPane, BeanProperty.create("icon")); binding.setConverter(serverStatusToIconConverter); bindingGroup.addBinding(binding); jXTaskPaneContainer1.add(analyzerIdpTaskPane); evaluationTaskPane.setFocusable(false); evaluationTaskPane.setTitle("Evaluation"); jXTaskPaneContainer1.add(evaluationTaskPane); logTaskPane.setFocusable(false); logTaskPane.setTitle("Other"); jXTaskPaneContainer1.add(logTaskPane); splitPane.setLeftComponent(jXTaskPaneContainer1); fileMenu.setMnemonic('F'); fileMenu.setText("File"); saveItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.ALT_MASK)); saveItem.setText("Save Config"); saveItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { saveItemActionPerformed(evt); } }); fileMenu.add(saveItem); loadItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_L, InputEvent.ALT_MASK)); loadItem.setText("Load Config"); loadItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { loadItemActionPerformed(evt); } }); fileMenu.add(loadItem); fileMenu.add(jSeparator2); clearLogMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_MASK)); clearLogMenuItem.setText("Clear Log"); clearLogMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { clearLogMenuItemActionPerformed(evt); } }); fileMenu.add(clearLogMenuItem); fileMenu.add(jSeparator1); exitNoConfigSave.setText("Exit (without saving config)"); exitNoConfigSave.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { exitNoConfigSaveActionPerformed(evt); } }); fileMenu.add(exitNoConfigSave); exitAndSaveConfig.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_W, InputEvent.META_MASK)); exitAndSaveConfig.setText("Exit"); exitAndSaveConfig.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { exitAndSaveConfigActionPerformed(evt); } }); fileMenu.add(exitAndSaveConfig); menuBar.add(fileMenu); setJMenuBar(menuBar); GroupLayout layout = new GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(splitPane, GroupLayout.DEFAULT_SIZE, 960, Short.MAX_VALUE)); layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(splitPane, GroupLayout.DEFAULT_SIZE, 528, Short.MAX_VALUE)); bindingGroup.bind(); pack(); }
From source file:xtrememp.PlaylistManager.java
public void addFilesDialog(boolean playFirst) { JFileChooser fileChooser = new JFileChooser(Settings.getLastDir()); fileChooser.setAcceptAllFileFilterUsed(false); fileChooser.addChoosableFileFilter(audioFileFilter); fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); fileChooser.setMultiSelectionEnabled(true); if (fileChooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { File[] selectedFiles = fileChooser.getSelectedFiles(); Settings.setLastDir(selectedFiles[0].getParent()); addFiles(Arrays.asList(selectedFiles), playFirst); }//from w ww . j a va2 s . c o m }