private void selFolder() { // selects a single folder, then makes table uneditable other than launch, sel res folder and // cancel, gui table different, just shows folder final JFileChooser fc = new JFileChooser(currentPath); fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int result = fc.showOpenDialog(FrontEnd.this); dir = fc.getSelectedFile(); switch (result) { case JFileChooser.APPROVE_OPTION: dirImp = dir.toString(); dtm.getDataVector().removeAllElements(); dtm.fireTableDataChanged(); curRow = 0; addRow(); dtm.setValueAt( "You have chosen the folder '" + dirImp.substring(67) + "' and all of its subfolders.", 0, 0); dtm.setValueAt(dirImp.substring(67), 0, 1); if (table.getRowCount() > 0) { openF.setEnabled(false); openFo.setEnabled(false); selFo.setEnabled(false); canF.setEnabled(true); } selFoFl = 1; case JFileChooser.CANCEL_OPTION: break; } }
private void cancelSel() { // resets launch changes. dtm.getDataVector().removeAllElements(); dtm.fireTableDataChanged(); openF.setEnabled(true); openFo.setEnabled(true); selFo.setEnabled(true); canF.setEnabled(false); selFoFl = 0; curRow = 0; }