List of usage examples for javax.swing JFileChooser DIRECTORIES_ONLY
int DIRECTORIES_ONLY
To view the source code for javax.swing JFileChooser DIRECTORIES_ONLY.
Click Source Link
From source file:de.quadrillenschule.azocamsyncd.gui.ConfigurationWizardJFrame.java
private void autoruninstalljButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_autoruninstalljButton1ActionPerformed boolean success = false; JFileChooser jfc = new JFileChooser(); jfc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); jfc.setApproveButtonText("Prepare card..."); File startFile = new File(System.getProperty("user.dir")); //Get the current directory // Find System Root while (!FileSystemView.getFileSystemView().isFileSystemRoot(startFile)) { startFile = startFile.getParentFile(); }/*from w ww . j a v a2 s . com*/ jfc.setCurrentDirectory(startFile); int origDriveChooserRetVal = jfc.showDialog(rootPane, "Open"); if (origDriveChooserRetVal == JFileChooser.APPROVE_OPTION) { try { File myfile = new File(jfc.getSelectedFile().getAbsolutePath(), "autorun.sh"); myfile.createNewFile(); FileOutputStream fos; try { fos = new FileOutputStream(myfile); IOUtils.copy(getClass().getResourceAsStream( "/de/quadrillenschule/azocamsyncd/ftpservice/res/autorun.sh"), fos); fos.close(); success = true; } catch (FileNotFoundException ex) { Logger.getLogger(ConfigurationWizardJFrame.class.getName()).log(Level.SEVERE, null, ex); } } catch (IOException ex) { Logger.getLogger(ConfigurationWizardJFrame.class.getName()).log(Level.SEVERE, null, ex); } } if (!success) { JOptionPane.showMessageDialog(rootPane, "The WiFi is SD card could not be written to. Please check if you selected the right card and it is not write-protected.", "SD card could not be prepared", JOptionPane.WARNING_MESSAGE); } else { JOptionPane.showMessageDialog(rootPane, "The WiFi SD card is prepared for operating an FTP and Telnet server.", "Success!", JOptionPane.INFORMATION_MESSAGE); step0jCheckBox.setSelected(true); step0jCheckBox.setText("Done"); updateSelectedPanel(1); } }
From source file:gdsc.smlm.ij.plugins.PeakFit.java
/** * @return An input directory containing a series of images *///w w w .ja v a2s . co m @SuppressWarnings("unused") private String getInputDirectory(String title) { final JFileChooser chooser = new JFileChooser() { private static final long serialVersionUID = 275144634537614122L; public void approveSelection() { if (getSelectedFile().isFile()) { return; } else super.approveSelection(); } }; if (System.getProperty("os.name").startsWith("Mac OS X")) { chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); } else { chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); } chooser.setDialogTitle(title); int returnVal = chooser.showOpenDialog(IJ.getInstance()); if (returnVal == JFileChooser.APPROVE_OPTION) { return chooser.getSelectedFile().getPath(); } return null; }
From source file:ru.develgame.jflickrorganizer.MainForm.java
private void jButtonChooseBackupFolderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonChooseBackupFolderActionPerformed JFileChooser jFileChooserSaveBackup = new JFileChooser(); jFileChooserSaveBackup.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int returnVal = jFileChooserSaveBackup.showSaveDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { jTextFieldBackupFolder.setText(jFileChooserSaveBackup.getSelectedFile().getAbsolutePath()); }/* w w w .j a v a2s .c o m*/ }
From source file:com.stanley.captioner.MainFrame.java
private void outputDirectoryButtonActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_outputDirectoryButtonActionPerformed {//GEN-HEADEREND:event_outputDirectoryButtonActionPerformed JFileChooser fileChooser = new JFileChooser(); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); if (lastOutputDirectory != null) { fileChooser.setCurrentDirectory(lastOutputDirectory); }/*from w ww . j av a 2 s .c o m*/ int returnValue = fileChooser.showOpenDialog(this); if (returnValue == JFileChooser.APPROVE_OPTION) { lastOutputDirectory = fileChooser.getCurrentDirectory(); File file = fileChooser.getSelectedFile(); outputDirectoryField.setText(file.getAbsolutePath()); if (videoTable.getRowCount() > 0 && outputDirectoryField.getText().length() > 0) { convertButton.setEnabled(true); } } }
From source file:my.swingconnect.SwingConnectUI.java
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed //To BROWSE A FILE FROM THE DIRECTORY JFileChooser chooser = new JFileChooser(); //To enable showing hidden file chooser.setFileHidingEnabled(false); //To Enable selecting directory or files chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); //To enable multiple file selections chooser.setMultiSelectionEnabled(true); //Choice of user to save or open a file chooser.setDialogType(JFileChooser.OPEN_DIALOG); chooser.setDialogTitle("Choose a file..."); //To user to select a file if (chooser.showOpenDialog(SwingConnectUI.this) == JFileChooser.APPROVE_OPTION) { targetFile = chooser.getSelectedFile(); String directory = targetFile.getPath(); jTextField4.setText(targetFile.toString()); // files = new File("/Users/pradil90/Desktop/207dropbox").listFiles(); files = new File(directory).listFiles(); for (File file : files) { if (file.isFile()) { results.add(file.getAbsolutePath()); // results.add(file.getName()); System.out.println(file); count++;/* www . j ava2 s . c om*/ System.out.println(count); } } results.remove(0); jButton3.setEnabled(true); } }
From source file:it.staiger.jmeter.protocol.http.config.gui.DynamicFilePanel.java
/** * opens a dialog box to choose a file and returns selected file's * folder./*from w ww . j a v a 2 s . c o m*/ * * @return a new File object of selected folder */ private String browseAndGetFolderPath() { String path = folder.getText(); if (path.isEmpty()) path = FileDialoger.getLastJFCDirectory(); JFileChooser chooser = new JFileChooser(new File(path)); chooser.setDialogTitle("select folder");// $NON-NLS-1$ chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); chooser.setAcceptAllFileFilterUsed(false); if (chooser.showOpenDialog(GuiPackage.getInstance().getMainFrame()) == JFileChooser.APPROVE_OPTION) { path = chooser.getSelectedFile().getAbsolutePath(); FileDialoger.setLastJFCDirectory(path); } return path; }
From source file:faescapeplan.FAEscapePlanUI.java
/** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor.//from w w w. jav a2 s . c om */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { saveLocChooser = new javax.swing.JFileChooser(); iconPanel = new javax.swing.JPanel(); iconDisplay = new javax.swing.JLabel(); loginButton = new javax.swing.JButton(); jSeparator1 = new javax.swing.JSeparator(); statusBar = new javax.swing.JPanel(); statusText = new javax.swing.JLabel(); loginUser = new javax.swing.JTextField(); loginPass = new javax.swing.JPasswordField(); loginUserTitle = new javax.swing.JLabel(); loginPassTitle = new javax.swing.JLabel(); settingsPanel = new javax.swing.JPanel(); userTitle = new javax.swing.JLabel(); galleryTitle = new javax.swing.JLabel(); scrapsTitle = new javax.swing.JLabel(); favsTitle = new javax.swing.JLabel(); galleryCount = new javax.swing.JLabel(); scrapsCount = new javax.swing.JLabel(); favsCount = new javax.swing.JLabel(); galleryAction = new javax.swing.JComboBox<>(); scrapsAction = new javax.swing.JComboBox<>(); favsAction = new javax.swing.JComboBox<>(); jSeparator2 = new javax.swing.JSeparator(); journalsTitle = new javax.swing.JLabel(); notesTitle = new javax.swing.JLabel(); journalsCount = new javax.swing.JLabel(); notesCount = new javax.swing.JLabel(); journalsAction = new javax.swing.JComboBox<>(); notesAction = new javax.swing.JComboBox<>(); jSeparator3 = new javax.swing.JSeparator(); saveLocTitle = new javax.swing.JLabel(); saveLocText = new javax.swing.JTextField(); saveLocButton = new javax.swing.JButton(); backupProgress = new javax.swing.JProgressBar(); backupButton = new javax.swing.JButton(); refreshButton = new javax.swing.JButton(); jScrollPane1 = new javax.swing.JScrollPane(); logTextBox = new javax.swing.JTextArea(); menuBar = new javax.swing.JMenuBar(); menuFile = new javax.swing.JMenu(); menuExit = new javax.swing.JMenuItem(); menuHelp = new javax.swing.JMenu(); menuAbout = new javax.swing.JMenuItem(); saveLocChooser.setAcceptAllFileFilterUsed(false); saveLocChooser.setDialogType(javax.swing.JFileChooser.CUSTOM_DIALOG); saveLocChooser.setDialogTitle("Select backup folder location"); saveLocChooser.setFileSelectionMode(javax.swing.JFileChooser.DIRECTORIES_ONLY); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("FAEscapePlan"); setBackground(new java.awt.Color(255, 255, 255)); setResizable(false); setSize(new java.awt.Dimension(751, 418)); iconPanel.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED)); iconDisplay.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/FAtesticon.png"))); // NOI18N javax.swing.GroupLayout iconPanelLayout = new javax.swing.GroupLayout(iconPanel); iconPanel.setLayout(iconPanelLayout); iconPanelLayout.setHorizontalGroup(iconPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(iconDisplay)); iconPanelLayout.setVerticalGroup(iconPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(iconDisplay)); loginButton.setText("Log In"); loginButton.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { loginButtonMouseClicked(evt); } }); jSeparator1.setOrientation(javax.swing.SwingConstants.VERTICAL); jSeparator1.setPreferredSize(new java.awt.Dimension(10, 50)); statusBar.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED)); statusText.setText("Not logged in"); javax.swing.GroupLayout statusBarLayout = new javax.swing.GroupLayout(statusBar); statusBar.setLayout(statusBarLayout); statusBarLayout .setHorizontalGroup(statusBarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(statusText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); statusBarLayout .setVerticalGroup(statusBarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, statusBarLayout .createSequentialGroup().addGap(0, 0, Short.MAX_VALUE).addComponent(statusText))); loginUserTitle.setText("Username"); loginPassTitle.setText("Password"); userTitle.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N userTitle.setText("Username"); galleryTitle.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N galleryTitle.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); galleryTitle.setText("Gallery:"); galleryTitle.setMaximumSize(new java.awt.Dimension(60, 22)); galleryTitle.setMinimumSize(new java.awt.Dimension(60, 22)); galleryTitle.setPreferredSize(new java.awt.Dimension(60, 22)); scrapsTitle.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N scrapsTitle.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); scrapsTitle.setText("Scraps:"); favsTitle.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N favsTitle.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); favsTitle.setText("Favs:"); galleryCount.setFont(new java.awt.Font("Arial", 0, 18)); // NOI18N galleryCount.setText("0"); scrapsCount.setFont(new java.awt.Font("Arial", 0, 18)); // NOI18N scrapsCount.setText("0"); favsCount.setFont(new java.awt.Font("Arial", 0, 18)); // NOI18N favsCount.setText("0"); galleryAction.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N galleryAction.setModel(new javax.swing.DefaultComboBoxModel<>( new String[] { "New Backup", "Update backup", "No action" })); galleryAction.setEnabled(false); scrapsAction.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N scrapsAction.setModel(new javax.swing.DefaultComboBoxModel<>( new String[] { "New Backup", "Update backup", "No action" })); scrapsAction.setEnabled(false); favsAction.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N favsAction.setModel(new javax.swing.DefaultComboBoxModel<>( new String[] { "New Backup", "Update backup", "No action" })); favsAction.setEnabled(false); jSeparator2.setOrientation(javax.swing.SwingConstants.VERTICAL); journalsTitle.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N journalsTitle.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); journalsTitle.setText("Journals:"); notesTitle.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N notesTitle.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); notesTitle.setText("Notes:"); journalsCount.setFont(new java.awt.Font("Arial", 0, 18)); // NOI18N journalsCount.setText("0"); notesCount.setFont(new java.awt.Font("Arial", 0, 18)); // NOI18N notesCount.setText("0"); journalsAction.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N journalsAction.setModel(new javax.swing.DefaultComboBoxModel<>( new String[] { "New Backup", "Update backup", "No action" })); journalsAction.setEnabled(false); notesAction.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N notesAction.setModel(new javax.swing.DefaultComboBoxModel<>( new String[] { "New Backup", "Update backup", "No action" })); notesAction.setEnabled(false); saveLocTitle.setText("Backup folder:"); saveLocText.setText("C:\\"); saveLocButton.setText("..."); saveLocButton.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { saveLocButtonMouseClicked(evt); } }); backupButton.setFont(new java.awt.Font("Arial", 0, 18)); // NOI18N backupButton.setText("START"); backupButton.setEnabled(false); backupButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { backupButtonActionPerformed(evt); } }); refreshButton.setText("Refresh"); refreshButton.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { refreshButtonMouseClicked(evt); } }); javax.swing.GroupLayout settingsPanelLayout = new javax.swing.GroupLayout(settingsPanel); settingsPanel.setLayout(settingsPanelLayout); settingsPanelLayout.setHorizontalGroup( settingsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup( javax.swing.GroupLayout.Alignment.TRAILING, settingsPanelLayout.createSequentialGroup().addGroup(settingsPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(settingsPanelLayout.createSequentialGroup().addComponent(saveLocTitle) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(saveLocText) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(saveLocButton, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jSeparator3, javax.swing.GroupLayout.Alignment.LEADING) .addGroup(settingsPanelLayout.createSequentialGroup() .addComponent(userTitle, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(refreshButton)) .addGroup(settingsPanelLayout.createSequentialGroup().addGap(0, 0, Short.MAX_VALUE) .addGroup(settingsPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addGroup(settingsPanelLayout.createSequentialGroup() .addComponent(backupProgress, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(backupButton, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(settingsPanelLayout.createSequentialGroup() .addGroup(settingsPanelLayout .createParallelGroup( javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(favsTitle, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(galleryTitle, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(scrapsTitle, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(settingsPanelLayout .createParallelGroup( javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(scrapsCount, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 60, Short.MAX_VALUE) .addComponent(galleryCount, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(favsCount, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(18, 18, 18) .addGroup(settingsPanelLayout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addComponent(galleryAction, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(scrapsAction, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(favsAction, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(settingsPanelLayout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(journalsTitle, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(notesTitle, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(settingsPanelLayout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addGroup(settingsPanelLayout .createSequentialGroup() .addComponent(notesCount, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(notesAction, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(settingsPanelLayout .createSequentialGroup() .addComponent(journalsCount, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(journalsAction, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))))) .addGap(40, 40, 40))); settingsPanelLayout.setVerticalGroup(settingsPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(settingsPanelLayout.createSequentialGroup() .addGroup( settingsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(userTitle).addComponent(refreshButton)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(settingsPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(settingsPanelLayout.createSequentialGroup().addGroup(settingsPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(galleryAction, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(settingsPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(galleryTitle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(galleryCount).addComponent(journalsTitle) .addComponent(journalsCount).addComponent(journalsAction, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(settingsPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(scrapsTitle).addComponent(scrapsCount) .addComponent(scrapsAction, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(notesTitle).addComponent(notesCount) .addComponent(notesAction, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(settingsPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(favsTitle).addComponent(favsCount) .addComponent(favsAction, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addComponent(jSeparator2)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(settingsPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(saveLocTitle) .addComponent(saveLocText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(saveLocButton)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 11, Short.MAX_VALUE) .addGroup(settingsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(backupButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, settingsPanelLayout .createSequentialGroup() .addComponent(backupProgress, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(8, 8, 8))) .addContainerGap())); logTextBox.setEditable(false); logTextBox.setColumns(20); logTextBox.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N logTextBox.setRows(5); jScrollPane1.setViewportView(logTextBox); menuFile.setText("File"); menuExit.setText("Exit"); menuExit.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuExitActionPerformed(evt); } }); menuFile.add(menuExit); menuBar.add(menuFile); menuHelp.setText("Help"); menuAbout.setText("About..."); menuHelp.add(menuAbout); menuBar.add(menuHelp); setJMenuBar(menuBar); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addComponent(jScrollPane1).addContainerGap()) .addGroup(layout.createSequentialGroup() .addGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(loginUserTitle) .addComponent(iconPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(loginUser) .addComponent(loginButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(loginPassTitle).addComponent(loginPass)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(settingsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 570, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)))) .addComponent(statusBar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addGap(6, 6, 6) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(settingsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup() .addComponent(iconPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(loginUserTitle).addGap(0, 0, 0) .addComponent(loginUser, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(loginPassTitle).addGap(0, 0, 0) .addComponent(loginPass, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(loginButton)) .addComponent(jSeparator1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 126, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(statusBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))); pack(); }
From source file:GUI.MyCustomFilter.java
private void NewFileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_NewFileActionPerformed JFileChooser chooser = new JFileChooser(); chooser.setCurrentDirectory(new java.io.File(".")); chooser.setDialogTitle("choosertitle"); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); chooser.setAcceptAllFileFilterUsed(false); if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) { String path = chooser.getSelectedFile().getAbsolutePath(); String ext = FilenameUtils.getExtension(path); outputPath = path;/*w w w.j av a2 s. c o m*/ projectSelected = 1; //System.out.println("getCurrentDirectory(): " + chooser.getCurrentDirectory()); //System.out.println("getSelectedFile() : " + chooser.getSelectedFile()); } else { System.out.println("No Selection "); } }
From source file:com.mirth.connect.client.ui.panels.export.MessageExportPanel.java
private void browseSelected() { JFileChooser chooser = new JFileChooser(); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); if (userPreferences != null) { File currentDir = new File(userPreferences.get("currentDirectory", "")); if (currentDir.exists()) { chooser.setCurrentDirectory(currentDir); }/*w w w . j a va2 s . com*/ } if (chooser.showOpenDialog(getParent()) == JFileChooser.APPROVE_OPTION) { if (userPreferences != null) { userPreferences.put("currentDirectory", chooser.getCurrentDirectory().getPath()); } rootPathTextField.setText(chooser.getSelectedFile().getAbsolutePath()); } }
From source file:GUI.GraphicalInterface.java
@SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { savesJFileChooser = new javax.swing.JFileChooser(); workdirJFileChooser = new javax.swing.JFileChooser(); jColorChooser1 = new javax.swing.JColorChooser(); jPanel3 = new javax.swing.JPanel(); clearJCheckBox = new javax.swing.JCheckBox(); saveJCheckBox = new javax.swing.JCheckBox(); historyJCheckBox = new javax.swing.JCheckBox(); maxtimeJSlider = new javax.swing.JSlider(); adminJLabel = new javax.swing.JLabel(); rootJCheckBox = new javax.swing.JCheckBox(); rootPasswordJLabel = new javax.swing.JLabel(); passwordJTextField = new javax.swing.JTextField(); jLabel2 = new javax.swing.JLabel(); clearargJCheckBox = new javax.swing.JCheckBox(); jPanel4 = new javax.swing.JPanel(); manualJRadioButton = new javax.swing.JRadioButton(); commandJTextField = new javax.swing.JTextField(); executeManualJButton = new javax.swing.JButton(); optionJLabel = new javax.swing.JLabel(); optionJTextField = new javax.swing.JTextField(); argumentJLabel = new javax.swing.JLabel(); argumentJTextField = new javax.swing.JTextField(); commandJComboBox = new javax.swing.JComboBox(); listJRadioButton = new javax.swing.JRadioButton(); optionJComboBox = new javax.swing.JComboBox(); executeJButton = new javax.swing.JButton(); jButton1 = new javax.swing.JButton(); jPanel2 = new javax.swing.JPanel(); clearJButton = new javax.swing.JButton(); showHistoryJButton = new javax.swing.JButton(); clearHistoryJButton = new javax.swing.JButton(); saveButton = new javax.swing.JButton(); abortJButton = new javax.swing.JButton(); jPanel1 = new javax.swing.JPanel(); statusJLabel = new javax.swing.JLabel(); statusJProgressBar = new javax.swing.JProgressBar(); jTabbedPane1 = new javax.swing.JTabbedPane(); jScrollPane1 = new javax.swing.JScrollPane(); terminalJTextArea = new javax.swing.JTextArea(); jScrollPane2 = new javax.swing.JScrollPane(); descriptionJTextArea = new javax.swing.JTextArea(); jMenuBar1 = new javax.swing.JMenuBar(); jMenu1 = new javax.swing.JMenu(); jMenuItem2 = new javax.swing.JMenuItem(); jMenuItem1 = new javax.swing.JMenuItem(); jMenu3 = new javax.swing.JMenu(); jMenuItem7 = new javax.swing.JMenuItem(); jMenuItem6 = new javax.swing.JMenuItem(); jCheckBoxMenuItem1 = new javax.swing.JCheckBoxMenuItem(); jMenu2 = new javax.swing.JMenu(); jMenuItem5 = new javax.swing.JMenuItem(); jMenuItem4 = new javax.swing.JMenuItem(); jMenuItem3 = new javax.swing.JMenuItem(); savesJFileChooser.setDialogType(javax.swing.JFileChooser.SAVE_DIALOG); workdirJFileChooser.setDialogType(javax.swing.JFileChooser.CUSTOM_DIALOG); workdirJFileChooser.setApproveButtonText("Select directory"); workdirJFileChooser.setApproveButtonToolTipText("Choose working directory for command execution"); workdirJFileChooser.setDialogTitle("Choose working directory"); workdirJFileChooser.setFileFilter(null); workdirJFileChooser.setFileSelectionMode(javax.swing.JFileChooser.DIRECTORIES_ONLY); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("Grafcom Graphical Commander"); setResizable(false);/* w w w. j a v a 2 s . c o m*/ jPanel3.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 204, 204))); clearJCheckBox.setText("Clear terminal before executing command"); clearJCheckBox.setFocusPainted(false); saveJCheckBox.setText("Open file after saving"); saveJCheckBox.setFocusPainted(false); historyJCheckBox.setText("Do not save command history"); historyJCheckBox.setFocusPainted(false); historyJCheckBox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { historyJCheckBoxActionPerformed(evt); } }); maxtimeJSlider.setMajorTickSpacing(3); maxtimeJSlider.setMaximum(21); maxtimeJSlider.setMinimum(3); maxtimeJSlider.setPaintLabels(true); maxtimeJSlider.setSnapToTicks(true); maxtimeJSlider.setValue(3); maxtimeJSlider.setFocusable(false); adminJLabel.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N adminJLabel.setText("Superuser privileges (Linux-based systems only)"); rootJCheckBox.setText("Run command as root"); rootJCheckBox.setFocusPainted(false); rootJCheckBox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { rootJCheckBoxActionPerformed(evt); } }); rootPasswordJLabel.setText("root password:"); passwordJTextField.setForeground(new java.awt.Color(254, 254, 254)); passwordJTextField .setToolTipText("Enter password here. Password not visible due to security considerations"); passwordJTextField.setEnabled(false); passwordJTextField.setSelectionColor(new java.awt.Color(254, 254, 254)); jLabel2.setText("Set command execution timeout (seconds)"); clearargJCheckBox.setText("Clear command arguments after execution"); javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout.setHorizontalGroup(jPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup().addGroup(jPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup().addContainerGap().addGroup(jPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(rootJCheckBox).addComponent(adminJLabel) .addGroup(jPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(clearargJCheckBox).addComponent(saveJCheckBox) .addComponent(historyJCheckBox).addComponent(clearJCheckBox)) .addGroup(jPanel3Layout.createSequentialGroup() .addComponent(rootPasswordJLabel).addGap(4, 4, 4).addComponent( passwordJTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE))))) .addGroup(jPanel3Layout.createSequentialGroup().addGap(37, 37, 37).addComponent( maxtimeJSlider, javax.swing.GroupLayout.PREFERRED_SIZE, 281, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel3Layout.createSequentialGroup().addGap(76, 76, 76).addComponent(jLabel2))) .addGap(52, 52, 52))); jPanel3Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] { clearJCheckBox, historyJCheckBox, saveJCheckBox }); jPanel3Layout.setVerticalGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup().addContainerGap().addComponent(jLabel2) .addGap(2, 2, 2) .addComponent(maxtimeJSlider, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(clearJCheckBox) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(clearargJCheckBox) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(saveJCheckBox) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(historyJCheckBox) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 8, Short.MAX_VALUE) .addComponent(adminJLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(rootJCheckBox) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(rootPasswordJLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(passwordJTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap())); jPanel4.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 204, 204))); manualJRadioButton.setText("Type command manually"); manualJRadioButton.setFocusPainted(false); manualJRadioButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { manualJRadioButtonActionPerformed(evt); } }); commandJTextField.setToolTipText("Enter command to execute"); executeManualJButton.setIcon( new javax.swing.ImageIcon(getClass().getResource("/Resources/icon/utilities-terminal16x16.png"))); // NOI18N executeManualJButton.setText("Execute"); executeManualJButton.setFocusPainted(false); executeManualJButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { executeManualJButtonActionPerformed(evt); } }); optionJLabel.setText("option argument:"); optionJTextField.setToolTipText("Specify the argument for the selected option"); optionJTextField.setEnabled(false); argumentJLabel.setText("command argument:"); argumentJTextField.setToolTipText("Specify the argument for the selected command"); argumentJTextField.setEnabled(false); commandJComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "(Select command)" })); commandJComboBox.setToolTipText("Select command to execute"); commandJComboBox.setFocusable(false); commandJComboBox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { commandJComboBoxActionPerformed(evt); } }); listJRadioButton.setSelected(true); listJRadioButton.setText("Select command from list"); listJRadioButton.setFocusPainted(false); listJRadioButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { listJRadioButtonActionPerformed(evt); } }); optionJComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "(Select option)" })); optionJComboBox.setToolTipText("Choose option for the selected command"); optionJComboBox.setEnabled(false); optionJComboBox.setFocusable(false); executeJButton.setIcon( new javax.swing.ImageIcon(getClass().getResource("/Resources/icon/utilities-terminal16x16.png"))); // NOI18N executeJButton.setText("Execute"); executeJButton.setToolTipText("Click to execute command with the given parameters"); executeJButton.setEnabled(false); executeJButton.setFocusPainted(false); executeJButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { executeJButtonActionPerformed(evt); } }); jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Resources/icon/folder.png"))); // NOI18N jButton1.setText("Set command execution path..."); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); jPanel4.setLayout(jPanel4Layout); jPanel4Layout.setHorizontalGroup(jPanel4Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup().addContainerGap().addGroup(jPanel4Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE) .addGroup(jPanel4Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(argumentJLabel).addComponent(optionJLabel)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel4Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(argumentJTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 217, Short.MAX_VALUE) .addComponent(optionJTextField)) .addGap(113, 113, 113)) .addGroup(jPanel4Layout.createSequentialGroup().addGroup(jPanel4Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(listJRadioButton) .addGroup(jPanel4Layout.createSequentialGroup() .addComponent(commandJComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(optionJComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(executeJButton)) .addComponent(manualJRadioButton) .addGroup(jPanel4Layout.createSequentialGroup() .addComponent(commandJTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 253, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(executeManualJButton)) .addGroup(jPanel4Layout.createSequentialGroup().addGap(79, 79, 79) .addComponent(jButton1))) .addContainerGap())))); jPanel4Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] { argumentJLabel, optionJLabel }); jPanel4Layout.setVerticalGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup() .addContainerGap().addComponent(listJRadioButton).addGap(4, 4, 4) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(commandJComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(optionJComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(executeJButton)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(argumentJTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(argumentJLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup( jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(optionJTextField).addComponent(optionJLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(7, 7, 7).addComponent(manualJRadioButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(commandJTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(executeManualJButton)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jButton1) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jPanel4Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] { argumentJTextField, optionJTextField }); clearJButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Resources/icon/edit-clear.png"))); // NOI18N clearJButton.setText("Clear Terminal"); clearJButton.setToolTipText("Click to clear terminal output"); clearJButton.setFocusPainted(false); clearJButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { clearJButtonActionPerformed(evt); } }); showHistoryJButton.setIcon( new javax.swing.ImageIcon(getClass().getResource("/Resources/icon/format-justify-fill.png"))); // NOI18N showHistoryJButton.setText("Show history"); showHistoryJButton.setToolTipText("Click to display the list of commands executed"); showHistoryJButton.setFocusPainted(false); showHistoryJButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { showHistoryJButtonActionPerformed(evt); } }); clearHistoryJButton .setIcon(new javax.swing.ImageIcon(getClass().getResource("/Resources/icon/edit-clear.png"))); // NOI18N clearHistoryJButton.setText("Clear History"); clearHistoryJButton.setFocusPainted(false); clearHistoryJButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { clearHistoryJButtonActionPerformed(evt); } }); saveButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Resources/icon/media-floppy.png"))); // NOI18N saveButton.setText("Save to file..."); saveButton.setFocusPainted(false); saveButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { saveButtonActionPerformed(evt); } }); abortJButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Resources/icon/process-stop.png"))); // NOI18N abortJButton.setText("Abort"); abortJButton.setToolTipText("Abort command execution"); abortJButton.setEnabled(false); abortJButton.setFocusPainted(false); abortJButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { abortJButtonActionPerformed(evt); } }); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup(jPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup().addGap(13, 13, 13).addComponent(clearJButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(showHistoryJButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(clearHistoryJButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(saveButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(abortJButton) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(clearJButton).addComponent(showHistoryJButton) .addComponent(clearHistoryJButton).addComponent(saveButton).addComponent(abortJButton))); jPanel1.setBackground(new java.awt.Color(51, 51, 51)); statusJLabel.setForeground(new java.awt.Color(255, 255, 255)); statusJLabel.setText("Select command from drop-down list or type manually to execute."); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup().addContainerGap() .addComponent(statusJLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(statusJProgressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap())); jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(statusJLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 27, Short.MAX_VALUE) .addComponent(statusJProgressBar, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); jScrollPane1.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); terminalJTextArea.setEditable(false); terminalJTextArea.setBackground(new java.awt.Color(51, 51, 51)); terminalJTextArea.setColumns(20); terminalJTextArea.setFont(new java.awt.Font("Consolas", 0, 13)); // NOI18N terminalJTextArea.setForeground(new java.awt.Color(204, 204, 204)); terminalJTextArea.setLineWrap(true); terminalJTextArea.setRows(5); terminalJTextArea.setTabSize(3); terminalJTextArea.setToolTipText("Displays output of command executed"); terminalJTextArea.setCaretColor(new java.awt.Color(204, 204, 204)); terminalJTextArea.setCursor(new java.awt.Cursor(java.awt.Cursor.TEXT_CURSOR)); terminalJTextArea.setMargin(new java.awt.Insets(8, 4, 4, 4)); terminalJTextArea.setSelectionColor(new java.awt.Color(153, 153, 153)); jScrollPane1.setViewportView(terminalJTextArea); jTabbedPane1.addTab("Terminal Emulator", jScrollPane1); jScrollPane2.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); descriptionJTextArea.setEditable(false); descriptionJTextArea.setColumns(20); descriptionJTextArea.setFont(new java.awt.Font("Consolas", 0, 13)); // NOI18N descriptionJTextArea.setLineWrap(true); descriptionJTextArea.setRows(5); descriptionJTextArea.setTabSize(3); descriptionJTextArea.setToolTipText("Description of selected command and its options"); descriptionJTextArea.setWrapStyleWord(true); descriptionJTextArea.setCaretColor(new java.awt.Color(255, 255, 255)); descriptionJTextArea.setCursor(new java.awt.Cursor(java.awt.Cursor.TEXT_CURSOR)); descriptionJTextArea.setFocusable(false); descriptionJTextArea.setMargin(new java.awt.Insets(4, 4, 4, 4)); descriptionJTextArea.setSelectionColor(new java.awt.Color(51, 204, 255)); jScrollPane2.setViewportView(descriptionJTextArea); jTabbedPane1.addTab("Command Description", jScrollPane2); jMenu1.setText("File"); jMenuItem2.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK)); jMenuItem2.setText("Save output to file..."); jMenuItem2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem2ActionPerformed(evt); } }); jMenu1.add(jMenuItem2); jMenuItem1.setText("Exit"); jMenuItem1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem1ActionPerformed(evt); } }); jMenu1.add(jMenuItem1); jMenuBar1.add(jMenu1); jMenu3.setText("Settings"); jMenuItem7.setText("Terminal background color"); jMenuItem7.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem7ActionPerformed(evt); } }); jMenu3.add(jMenuItem7); jMenuItem6.setText("Terminal text color"); jMenuItem6.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem6ActionPerformed(evt); } }); jMenu3.add(jMenuItem6); jCheckBoxMenuItem1.setSelected(true); jCheckBoxMenuItem1.setText("Sounds"); jCheckBoxMenuItem1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jCheckBoxMenuItem1ActionPerformed(evt); } }); jMenu3.add(jCheckBoxMenuItem1); jMenuBar1.add(jMenu3); jMenu2.setText("Help"); jMenuItem5.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F1, 0)); jMenuItem5.setText("Grafcom help contents"); jMenuItem5.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem5ActionPerformed(evt); } }); jMenu2.add(jMenuItem5); jMenuItem4.setText("Project Homepage"); jMenuItem4.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem4ActionPerformed(evt); } }); jMenu2.add(jMenuItem4); jMenuItem3.setText("About"); jMenuItem3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem3ActionPerformed(evt); } }); jMenu2.add(jMenuItem3); jMenuBar1.add(jMenu2); setJMenuBar(jMenuBar1); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup( javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup().addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, 372, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jTabbedPane1)) .addGap(11, 11, 11)) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(18, 18, 18).addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup().addComponent(jTabbedPane1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))); pack(); setLocationRelativeTo(null); }