Example usage for javax.swing JFileChooser CUSTOM_DIALOG

List of usage examples for javax.swing JFileChooser CUSTOM_DIALOG

Introduction

In this page you can find the example usage for javax.swing JFileChooser CUSTOM_DIALOG.

Prototype

int CUSTOM_DIALOG

To view the source code for javax.swing JFileChooser CUSTOM_DIALOG.

Click Source Link

Document

Type value indicating that the JFileChooser supports a developer-specified file operation.

Usage

From source file:Main.java

/**
 * Displays the given file chooser. Utility method for avoiding of memory leak in JDK
 * 1.3 {@link javax.swing.JFileChooser#showDialog}.
 *
 * @param chooser the file chooser to display.
 * @param parent the parent window.//w ww . j a v a  2  s .c o  m
 * @param approveButtonText the text for the approve button.
 *
 * @return the return code of the chooser.
 */
public static final int showJFileChooser(JFileChooser chooser, Component parent, String approveButtonText) {
    if (approveButtonText != null) {
        chooser.setApproveButtonText(approveButtonText);
        chooser.setDialogType(javax.swing.JFileChooser.CUSTOM_DIALOG);
    }

    Frame frame = (parent instanceof Frame) ? (Frame) parent
            : (Frame) javax.swing.SwingUtilities.getAncestorOfClass(java.awt.Frame.class, parent);
    String title = chooser.getDialogTitle();

    if (title == null) {
        title = chooser.getUI().getDialogTitle(chooser);
    }

    final JDialog dialog = new JDialog(frame, title, true);
    dialog.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

    Container contentPane = dialog.getContentPane();
    contentPane.setLayout(new BorderLayout());
    contentPane.add(chooser, BorderLayout.CENTER);
    dialog.pack();
    dialog.setLocationRelativeTo(parent);
    chooser.rescanCurrentDirectory();

    final int[] retValue = new int[] { javax.swing.JFileChooser.CANCEL_OPTION };

    ActionListener l = new ActionListener() {
        public void actionPerformed(ActionEvent ev) {
            if (ev.getActionCommand() == JFileChooser.APPROVE_SELECTION) {
                retValue[0] = JFileChooser.APPROVE_OPTION;
            }

            dialog.setVisible(false);
            dialog.dispose();
        }
    };

    chooser.addActionListener(l);
    dialog.show();

    return (retValue[0]);
}

From source file:net.sf.jabref.importer.ImportCustomizationDialog.java

/**
 *
 * @param frame/* ww  w.  j  a v  a 2 s.c o  m*/
 */
public ImportCustomizationDialog(final JabRefFrame frame) {
    super(frame, Localization.lang("Manage custom imports"), false);

    ImportTableModel tableModel = new ImportTableModel();
    customImporterTable = new JTable(tableModel);
    TableColumnModel cm = customImporterTable.getColumnModel();
    cm.getColumn(0).setPreferredWidth(COL_0_WIDTH);
    cm.getColumn(1).setPreferredWidth(COL_1_WIDTH);
    cm.getColumn(2).setPreferredWidth(COL_2_WIDTH);
    cm.getColumn(3).setPreferredWidth(COL_3_WIDTH);
    JScrollPane sp = new JScrollPane(customImporterTable, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    customImporterTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    customImporterTable.setPreferredScrollableViewportSize(getSize());
    if (customImporterTable.getRowCount() > 0) {
        customImporterTable.setRowSelectionInterval(0, 0);
    }

    JButton addFromFolderButton = new JButton(Localization.lang("Add from folder"));
    addFromFolderButton.addActionListener(e -> {
        CustomImporter importer = new CustomImporter();
        importer.setBasePath(FileDialogs.getNewDir(frame,
                new File(Globals.prefs.get(JabRefPreferences.WORKING_DIRECTORY)), Collections.emptyList(),
                Localization.lang("Select Classpath of New Importer"), JFileChooser.CUSTOM_DIALOG, false));
        String chosenFileStr = null;
        if (importer.getBasePath() != null) {
            chosenFileStr = FileDialogs.getNewFile(frame, importer.getFileFromBasePath(),
                    Collections.singletonList(".class"), Localization.lang("Select new ImportFormat subclass"),
                    JFileChooser.CUSTOM_DIALOG, false);
        }
        if (chosenFileStr != null) {
            try {
                importer.setClassName(pathToClass(importer.getFileFromBasePath(), new File(chosenFileStr)));
                importer.setName(importer.getInstance().getFormatName());
                importer.setCliId(importer.getInstance().getId());
                addOrReplaceImporter(importer);
                customImporterTable.revalidate();
                customImporterTable.repaint();
            } catch (Exception exc) {
                JOptionPane.showMessageDialog(frame,
                        Localization.lang("Could not instantiate %0", chosenFileStr));
            } catch (NoClassDefFoundError exc) {
                JOptionPane.showMessageDialog(frame, Localization.lang(
                        "Could not instantiate %0. Have you chosen the correct package path?", chosenFileStr));
            }

        }
    });
    addFromFolderButton
            .setToolTipText(Localization.lang("Add a (compiled) custom ImportFormat class from a class path.")
                    + "\n" + Localization.lang("The path need not be on the classpath of JabRef."));

    JButton addFromJarButton = new JButton(Localization.lang("Add from jar"));
    addFromJarButton.addActionListener(e -> {
        String basePath = FileDialogs.getNewFile(frame,
                new File(Globals.prefs.get(JabRefPreferences.WORKING_DIRECTORY)), Arrays.asList(".zip", ".jar"),
                Localization.lang("Select a Zip-archive"), JFileChooser.CUSTOM_DIALOG, false);

        if (basePath != null) {
            try (ZipFile zipFile = new ZipFile(new File(basePath), ZipFile.OPEN_READ)) {
                ZipFileChooser zipFileChooser = new ZipFileChooser(this, zipFile);
                zipFileChooser.setVisible(true);
                customImporterTable.revalidate();
                customImporterTable.repaint(10);
            } catch (IOException exc) {
                LOGGER.info("Could not open Zip-archive.", exc);
                JOptionPane.showMessageDialog(frame, Localization.lang("Could not open %0", basePath) + "\n"
                        + Localization.lang("Have you chosen the correct package path?"));
            } catch (NoClassDefFoundError exc) {
                LOGGER.info("Could not instantiate Zip-archive reader.", exc);
                JOptionPane.showMessageDialog(frame, Localization.lang("Could not instantiate %0", basePath)
                        + "\n" + Localization.lang("Have you chosen the correct package path?"));
            }
        }
    });
    addFromJarButton
            .setToolTipText(Localization.lang("Add a (compiled) custom ImportFormat class from a Zip-archive.")
                    + "\n" + Localization.lang("The Zip-archive need not be on the classpath of JabRef."));

    JButton showDescButton = new JButton(Localization.lang("Show description"));
    showDescButton.addActionListener(e -> {
        int row = customImporterTable.getSelectedRow();
        if (row == -1) {
            JOptionPane.showMessageDialog(frame, Localization.lang("Please select an importer."));
        } else {
            CustomImporter importer = ((ImportTableModel) customImporterTable.getModel()).getImporter(row);
            try {
                ImportFormat importFormat = importer.getInstance();
                JOptionPane.showMessageDialog(frame, importFormat.getDescription());
            } catch (IOException | ClassNotFoundException | InstantiationException
                    | IllegalAccessException exc) {
                LOGGER.warn("Could not instantiate importer " + importer.getName(), exc);
                JOptionPane.showMessageDialog(frame, Localization.lang("Could not instantiate %0 %1",
                        importer.getName() + ":\n", exc.getMessage()));
            }
        }
    });

    JButton removeButton = new JButton(Localization.lang("Remove"));
    removeButton.addActionListener(e -> {
        int row = customImporterTable.getSelectedRow();
        if (row == -1) {
            JOptionPane.showMessageDialog(frame, Localization.lang("Please select an importer."));
        } else {
            customImporterTable.removeRowSelectionInterval(row, row);
            Globals.prefs.customImports
                    .remove(((ImportTableModel) customImporterTable.getModel()).getImporter(row));
            Globals.IMPORT_FORMAT_READER.resetImportFormats();
            customImporterTable.revalidate();
            customImporterTable.repaint();
        }
    });

    Action closeAction = new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            dispose();
        }
    };

    JButton closeButton = new JButton(Localization.lang("Close"));
    closeButton.addActionListener(closeAction);

    JButton helpButton = new HelpAction(HelpFile.CUSTOM_IMPORTS).getHelpButton();

    // Key bindings:
    JPanel mainPanel = new JPanel();
    ActionMap am = mainPanel.getActionMap();
    InputMap im = mainPanel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
    im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close");
    am.put("close", closeAction);
    mainPanel.setLayout(new BorderLayout());
    mainPanel.add(sp, BorderLayout.CENTER);
    JPanel buttons = new JPanel();
    ButtonBarBuilder bb = new ButtonBarBuilder(buttons);
    buttons.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
    bb.addGlue();
    bb.addButton(addFromFolderButton);
    bb.addButton(addFromJarButton);
    bb.addButton(showDescButton);
    bb.addButton(removeButton);
    bb.addButton(closeButton);
    bb.addUnrelatedGap();
    bb.addButton(helpButton);
    bb.addGlue();

    getContentPane().add(mainPanel, BorderLayout.CENTER);
    getContentPane().add(buttons, BorderLayout.SOUTH);
    this.setSize(getSize());
    pack();
    this.setLocationRelativeTo(frame);
    new FocusRequester(customImporterTable);
}

From source file:de.dmarcini.submatix.pclogger.gui.ProgramProperetysDialog.java

/**
 * Das exportverzeichis auswhlen Project: SubmatixBTForPC Package: de.dmarcini.submatix.pclogger.gui
 * /*from   www.  j a  v  a 2 s.  co m*/
 * @author Dirk Marciniak (dirk_marciniak@arcor.de) Stand: 28.08.2012
 */
private void chooseExportDir() {
    JFileChooser fileChooser;
    int retVal;
    //
    // Einen Dateiauswahldialog Creieren
    //
    fileChooser = new JFileChooser();
    fileChooser.setLocale(Locale.getDefault());
    fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    fileChooser.setDialogTitle(fileChooserExportDirTitle);
    fileChooser.setDialogType(JFileChooser.CUSTOM_DIALOG);
    fileChooser.setApproveButtonToolTipText(approveDirButtonTooltip);
    // das existierende Verzeichnis voreinstellen
    fileChooser.setSelectedFile(SpxPcloggerProgramConfig.exportDir);
    retVal = fileChooser.showDialog(this, approveDirButtonText);
    // Mal sehen, was der User gewollt hat
    if (retVal == JFileChooser.APPROVE_OPTION) {
        // Ja, ich wollte das so
        exportDirTextField.setText(fileChooser.getSelectedFile().getAbsolutePath());
        wasChangedParameter = true;
    }
}

From source file:de.dmarcini.submatix.pclogger.gui.ProgramProperetysDialog.java

/**
 * Verzeichnis fr die Daten auswhlen Project: SubmatixBTForPC Package: de.dmarcini.submatix.pclogger.gui
 * //from ww  w  . j a va2s.  c  o  m
 * @author Dirk Marciniak (dirk_marciniak@arcor.de) Stand: 03.08.2012
 */
private void chooseDataDir() {
    JFileChooser fileChooser;
    int retVal;
    //
    // Einen Dateiauswahldialog Creieren
    //
    fileChooser = new JFileChooser();
    fileChooser.setLocale(Locale.getDefault());
    fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    fileChooser.setDialogTitle(fileChooserDirTitle);
    fileChooser.setDialogType(JFileChooser.CUSTOM_DIALOG);
    fileChooser.setApproveButtonToolTipText(approveDirButtonTooltip);
    // das existierende Logfile voreinstellen
    fileChooser.setSelectedFile(SpxPcloggerProgramConfig.databaseDir);
    retVal = fileChooser.showDialog(this, approveDirButtonText);
    // Mal sehen, was der User gewollt hat
    if (retVal == JFileChooser.APPROVE_OPTION) {
        // Ja, ich wollte das so
        databaseDirTextField.setText(fileChooser.getSelectedFile().getAbsolutePath());
        wasChangedParameter = true;
    }
}

From source file:de.dmarcini.submatix.pclogger.gui.ProgramProperetysDialog.java

/**
 * Suche einen Platz und den Namen frs Logfile Project: SubmatixBTForPC Package: de.dmarcini.submatix.pclogger.gui
 * /*from www.j a v a  2  s .c o  m*/
 * @author Dirk Marciniak (dirk_marciniak@arcor.de) Stand: 03.08.2012
 */
private void chooseLogFile() {
    JFileChooser fileChooser;
    int retVal;
    //
    // Einen Dateiauswahldialog Creieren
    //
    fileChooser = new JFileChooser();
    fileChooser.setLocale(Locale.getDefault());
    fileChooser.setDialogTitle(fileChooserLogTitle);
    fileChooser.setDialogType(JFileChooser.CUSTOM_DIALOG);
    fileChooser.setApproveButtonToolTipText(approveLogButtonTooltip);
    // das existierende Logfile voreinstellen
    fileChooser.setSelectedFile(SpxPcloggerProgramConfig.logFile);
    retVal = fileChooser.showDialog(this, approveLogButtonText);
    // Mal sehen, was der User gewollt hat
    if (retVal == JFileChooser.APPROVE_OPTION) {
        // Ja, ich wollte das so
        // nach dem nchsten Programmstart dieses File anlegen/nutzen
        logfileNameTextField.setText(fileChooser.getSelectedFile().getAbsolutePath());
        wasChangedParameter = true;
        lg.debug("select <" + fileChooser.getSelectedFile().getName() + "> as new logfile after restart.");
    }
}

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./*w  w  w .java 2s. co  m*/
 */
@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.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 ww  . ja  v a2s. co  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);
}

From source file:simMPLS.ui.simulator.JVentanaHija.java

/**
 * Este mtodo se encarga de controlar que todo ocurre como debe con respecto al
 * escenario, cuando se pulsa en el men principal la opcin de "Guardar como..."
 * @since 1.0/*from   w  w  w . j a  v a  2  s . com*/
 */
public void gestionarGuardarComo() {
    anotarDatosDeEscenario();
    JFileChooser dialogoGuardar = new JFileChooser();
    dialogoGuardar.setFileFilter(new JOSMFilter());
    dialogoGuardar.setDialogType(JFileChooser.CUSTOM_DIALOG);
    dialogoGuardar.setApproveButtonMnemonic('A');
    dialogoGuardar.setApproveButtonText(java.util.ResourceBundle.getBundle("simMPLS/lenguajes/lenguajes")
            .getString("JVentanaHija.DialogoGuardar.OK"));
    dialogoGuardar.setDialogTitle(java.util.ResourceBundle.getBundle("simMPLS/lenguajes/lenguajes")
            .getString("JVentanaHija.DialogoGuardar.Almacenar") + this.getTitle()
            + java.util.ResourceBundle.getBundle("simMPLS/lenguajes/lenguajes").getString("-"));
    dialogoGuardar.setAcceptAllFileFilterUsed(false);
    dialogoGuardar.setSelectedFile(new File(this.getTitle()));
    dialogoGuardar.setFileSelectionMode(JFileChooser.FILES_ONLY);
    int resultado = dialogoGuardar.showSaveDialog(VentanaPadre);
    if (resultado == JFileChooser.APPROVE_OPTION) {
        String ext = null;
        String nombreFich = dialogoGuardar.getSelectedFile().getPath();
        int i = nombreFich.lastIndexOf('.');
        if (i > 0 && i < nombreFich.length() - 1) {
            ext = nombreFich.substring(i + 1).toLowerCase();
        }
        if (ext == null) {
            nombreFich += java.util.ResourceBundle.getBundle("simMPLS/lenguajes/lenguajes").getString(".osm");
        } else {
            if (!ext.equals(
                    java.util.ResourceBundle.getBundle("simMPLS/lenguajes/lenguajes").getString("osm"))) {
                nombreFich += java.util.ResourceBundle.getBundle("simMPLS/lenguajes/lenguajes")
                        .getString(".osm");
            }
        }
        dialogoGuardar.setSelectedFile(new File(nombreFich));
        escenario.setFile(dialogoGuardar.getSelectedFile());
        this.escenario.setSaved(true);
        this.setTitle(this.escenario.obtenerFichero().getName());
        TOSMSaver almacenador = new TOSMSaver(escenario);
        //            JVentanaBooleana vb = new JVentanaBooleana(this.VentanaPadre, true, this.dispensadorDeImagenes);
        //            vb.mostrarPregunta(java.util.ResourceBundle.getBundle("simMPLS/lenguajes/lenguajes").getString("JVentanaHija.PreguntaEmpotrarCRC"));
        //            vb.show();
        //            boolean conCRC = vb.obtenerRespuesta();
        //            boolean correcto = almacenador.save(escenario.obtenerFichero(), conCRC);
        JVentanaBooleana vb = new JVentanaBooleana(this.VentanaPadre, true, this.dispensadorDeImagenes);
        vb.mostrarPregunta("Do you want to save the routing tables ?");
        vb.show();
        boolean saveTables = vb.obtenerRespuesta();
        boolean correcto = almacenador.save(escenario.obtenerFichero(), false, saveTables);
        if (correcto) {
            this.escenario.setModified(false);
            this.escenario.setSaved(true);
        }
    }
}

From source file:plugin.notes.gui.NotesView.java

/**
 *  obtains an Image for input using a custom JFileChooser dialog
 *
 *@param  startDir  Directory to open JFielChooser to
 *@param  exts      Extensions to search for
 *@param  desc      Description for files
 *@return           File pointing to the selected image
 *//*ww w  .  ja v a2 s. c o  m*/
private File getImageFromChooser(String startDir, String[] exts, String desc) {
    JFileChooser jImageDialog = new JFileChooser();
    jImageDialog.setCurrentDirectory(new File(startDir));
    jImageDialog.setAccessory(new ImageFileChooserPreview(jImageDialog));
    jImageDialog.setDialogType(JFileChooser.CUSTOM_DIALOG);
    jImageDialog.setFileFilter(new FileNameExtensionFilter(desc, exts));
    jImageDialog.setDialogTitle("Select an Image to Insert");

    int optionSelected = jImageDialog.showDialog(this, "Insert");

    if (optionSelected == JFileChooser.APPROVE_OPTION) {
        return jImageDialog.getSelectedFile();
    }

    return null;
}