Example usage for javax.swing JProgressBar JProgressBar

List of usage examples for javax.swing JProgressBar JProgressBar

Introduction

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

Prototype

public JProgressBar() 

Source Link

Document

Creates a horizontal progress bar that displays a border but no progress string.

Usage

From source file:Import.pnl_import_vcf.java

public void progressBar() {
    JProgressBar progressBar = new JProgressBar();
    TitledBorder border = BorderFactory.createTitledBorder("Importing...");
    progressBar.setBorder(border);//from w w  w . ja v  a 2 s. co  m
    progressBar.setIndeterminate(true);
    JDialog dialog = new JDialog();
}

From source file:com.sciaps.view.SpectrumShotPanel.java

private void doCreateAvg() {

    BackgroundTask.runBackgroundTask(new BackgroundTask() {

        private JDialog mDialog;
        private JProgressBar mProgress;

        @Override/*from www . j  a  va  2  s  .  c om*/
        public void onBefore() {
            mProgress = new JProgressBar();
            mProgress.setIndeterminate(true);

            mDialog = new JDialog(Constants.MAIN_FRAME);
            mDialog.setLocationRelativeTo(Constants.MAIN_FRAME);
            mDialog.setAlwaysOnTop(true);
            mDialog.setResizable(false);
            mDialog.setContentPane(mProgress);
            mDialog.setSize(400, 100);
            mDialog.setVisible(true);
        }

        @Override
        public void onBackground() {
            SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run() {
                    logger_.info("Creating avg from highlighted shots...");

                    StringBuilder name = new StringBuilder();

                    boolean gotScanID = false;
                    int[] selectedList = tblShots_.getSelectedRows();
                    List<Spectrum> shotDatas = new ArrayList<Spectrum>();

                    for (int i = 0; i < selectedList.length; i++) {
                        int modelIndex = tblShots_.convertRowIndexToModel(selectedList[i]);
                        SpectrumShotItem shotItem = (SpectrumShotItem) shotListTableModel_.getRow(modelIndex);
                        if (gotScanID == false) {
                            name.append("Scan ").append(shotItem.getScanID()).append(" Avg: ");
                            gotScanID = true;
                        }
                        name.append(shotItem.getShotID());
                        name.append("_");

                        shotDatas.add(shotItem.getShot());
                    }
                    name = name.deleteCharAt(name.length() - 1);

                    AverageShotsSettingPanel avgPanel = new AverageShotsSettingPanel();
                    avgPanel.setAvgShotName(name.toString());
                    int sampleRate = validateOneOrGreater(txtSampleRate_);
                    if (sampleRate >= 1) {
                        avgPanel.setSampleRate(sampleRate);
                    } else {
                        avgPanel.setSampleRate(30);
                    }

                    CustomDialog dialog = new CustomDialog(Constants.MAIN_FRAME, "Shot Average Setting",
                            avgPanel, CustomDialog.OK_OPTION);
                    dialog.setSize(400, 200);
                    dialog.setVisible(true);

                    int retval = dialog.getResponseValue();
                    String newName = avgPanel.getAvgShotName();
                    while (retval == CustomDialog.OK && shotListTableModel_.isNameAlreadyExist(newName)) {
                        avgPanel.doNameAlreadyExist(true);
                        dialog.setVisible(true);
                        retval = dialog.getResponseValue();
                        newName = avgPanel.getAvgShotName();
                    }

                    if (retval == CustomDialog.OK) {
                        int newSampleRate = avgPanel.getSampleRate();

                        final SpectrumShotItem newShotItem = new SpectrumShotItem(newName.replace(",", "_"));
                        newShotItem.setShot(createAverage(shotDatas, newSampleRate), SpectrumShotItem.AVERAGED);

                        SwingUtilities.invokeLater(new Runnable() {
                            @Override
                            public void run() {
                                shotListTableModel_.addRow(0, newShotItem);
                                shotListTableModel_.setValueAt(true, 0, 0); //display it

                            }
                        });

                        logger_.info("Create Avg from highlighted shots.... done");
                    } else {
                        logger_.info("Create Avg aborted by user");
                    }
                }

            });
        }

        @Override

        public void onAfter() {
            mDialog.setVisible(false);
        }
    });
}

From source file:com.github.benchdoos.weblocopener.updater.gui.UpdateDialog.java

/**
 * Method generated by IntelliJ IDEA GUI Designer
 * >>> IMPORTANT!! <<<
 * DO NOT edit this method OR call it in your code!
 *
 * @noinspection ALL/*from   w w  w  . j  a  v  a  2 s .com*/
 */
private void $$$setupUI$$$() {
    contentPane = new JPanel();
    contentPane.setLayout(new GridLayoutManager(3, 1, new Insets(0, 0, 0, 0), -1, -1));
    final JPanel panel1 = new JPanel();
    panel1.setLayout(new GridLayoutManager(1, 1, new Insets(0, 10, 10, 10), -1, -1));
    contentPane.add(panel1,
            new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, 1, null, null,
                    null, 0, false));
    final JPanel panel2 = new JPanel();
    panel2.setLayout(new GridLayoutManager(2, 3, new Insets(0, 0, 0, 0), -1, -1));
    panel1.add(panel2,
            new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null,
                    null, 0, false));
    buttonOK = new JButton();
    buttonOK.setActionCommand(
            ResourceBundle.getBundle("translations/UpdateDialogBundle").getString("buttonOk"));
    buttonOK.setEnabled(false);
    Font buttonOKFont = this.$$$getFont$$$(null, Font.BOLD, -1, buttonOK.getFont());
    if (buttonOKFont != null)
        buttonOK.setFont(buttonOKFont);
    this.$$$loadButtonText$$$(buttonOK,
            ResourceBundle.getBundle("translations/UpdateDialogBundle").getString("buttonOk"));
    panel2.add(buttonOK,
            new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    buttonCancel = new JButton();
    buttonCancel.setActionCommand(
            ResourceBundle.getBundle("translations/UpdateDialogBundle").getString("buttonCancel"));
    this.$$$loadButtonText$$$(buttonCancel,
            ResourceBundle.getBundle("translations/UpdateDialogBundle").getString("buttonCancel"));
    panel2.add(buttonCancel,
            new GridConstraints(1, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    manualDownloadButton = new JButton();
    manualDownloadButton.setIcon(new ImageIcon(getClass().getResource("/images/downloadsIcon16.png")));
    manualDownloadButton.setInheritsPopupMenu(false);
    manualDownloadButton.setMargin(new Insets(2, 2, 2, 8));
    manualDownloadButton.setOpaque(true);
    manualDownloadButton.setRequestFocusEnabled(false);
    this.$$$loadButtonText$$$(manualDownloadButton,
            ResourceBundle.getBundle("translations/UpdateDialogBundle").getString("manualDownloadButtonText"));
    manualDownloadButton.setToolTipText(ResourceBundle.getBundle("translations/UpdateDialogBundle")
            .getString("manualDownloadButtonToolTip"));
    panel2.add(manualDownloadButton,
            new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    final Spacer spacer1 = new Spacer();
    panel2.add(spacer1,
            new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
    final JPanel panel3 = new JPanel();
    panel3.setLayout(new GridLayoutManager(4, 9, new Insets(10, 10, 0, 10), -1, -1));
    contentPane.add(panel3,
            new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null,
                    null, 0, false));
    final Spacer spacer2 = new Spacer();
    panel3.add(spacer2,
            new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1,
                    GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
    progressBar1 = new JProgressBar();
    progressBar1.setStringPainted(false);
    panel3.add(progressBar1,
            new GridConstraints(2, 0, 1, 9, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0,
                    false));
    currentVersionStringLabel = new JLabel();
    this.$$$loadLabelText$$$(currentVersionStringLabel,
            ResourceBundle.getBundle("translations/UpdateDialogBundle").getString("currentVersionStringLabel"));
    panel3.add(currentVersionStringLabel,
            new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0,
                    false));
    currentVersionLabel = new JLabel();
    Font currentVersionLabelFont = this.$$$getFont$$$(null, Font.BOLD, -1, currentVersionLabel.getFont());
    if (currentVersionLabelFont != null)
        currentVersionLabel.setFont(currentVersionLabelFont);
    currentVersionLabel.setText("");
    panel3.add(currentVersionLabel,
            new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0,
                    false));
    availableVersionStringLabel = new JLabel();
    this.$$$loadLabelText$$$(availableVersionStringLabel, ResourceBundle
            .getBundle("translations/UpdateDialogBundle").getString("availableVersionStringLabel"));
    panel3.add(availableVersionStringLabel,
            new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0,
                    false));
    availableVersionLabel = new JLabel();
    Font availableVersionLabelFont = this.$$$getFont$$$(null, Font.BOLD, -1, availableVersionLabel.getFont());
    if (availableVersionLabelFont != null)
        availableVersionLabel.setFont(availableVersionLabelFont);
    availableVersionLabel.setText("");
    panel3.add(availableVersionLabel,
            new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0,
                    false));
    final Spacer spacer3 = new Spacer();
    panel3.add(spacer3,
            new GridConstraints(1, 4, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
    newVersionSizeLabel = new JLabel();
    newVersionSizeLabel.setText("");
    panel3.add(newVersionSizeLabel,
            new GridConstraints(1, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0,
                    false));
    unitLabel = new JLabel();
    unitLabel.setText("");
    panel3.add(unitLabel,
            new GridConstraints(1, 3, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0,
                    false));
    updateInfoButton = new JButton();
    updateInfoButton.setBorderPainted(false);
    updateInfoButton.setContentAreaFilled(true);
    updateInfoButton.setDefaultCapable(true);
    updateInfoButton.setDoubleBuffered(false);
    updateInfoButton.setEnabled(false);
    updateInfoButton.setIcon(new ImageIcon(getClass().getResource("/images/infoIcon16.png")));
    updateInfoButton.setMargin(new Insets(2, 2, 2, 2));
    updateInfoButton.setRequestFocusEnabled(false);
    updateInfoButton.setText("");
    panel3.add(updateInfoButton,
            new GridConstraints(1, 8, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    errorPanel = new JPanel();
    errorPanel.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
    errorPanel.setBackground(new Color(-65536));
    errorPanel.setVisible(false);
    contentPane.add(errorPanel,
            new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null,
                    new Dimension(-1, 65), new Dimension(-1, 65), 0, false));
    errorTextPane = new JTextPane();
    errorTextPane.setBackground(new Color(-16777216));
    errorTextPane.setEditable(false);
    errorTextPane.setEnabled(true);
    errorTextPane.setFocusCycleRoot(false);
    errorTextPane.setFocusable(false);
    Font errorTextPaneFont = this.$$$getFont$$$("Segoe UI", Font.BOLD, 14, errorTextPane.getFont());
    if (errorTextPaneFont != null)
        errorTextPane.setFont(errorTextPaneFont);
    errorTextPane.setForeground(new Color(-1));
    errorTextPane.setOpaque(false);
    errorTextPane.setRequestFocusEnabled(false);
    errorTextPane.setVerifyInputWhenFocusTarget(false);
    errorPanel.add(errorTextPane,
            new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_WANT_GROW, null,
                    new Dimension(150, 50), null, 0, false));
}

From source file:de.bfs.radon.omsimulation.gui.OMPanelData.java

/**
 * Initialises the interface of the data panel.
 *//*from w ww  . j  a v  a  2 s.  c o m*/
protected void initialize() {
    setLayout(null);

    lblExportChartTo = new JLabel("Export chart to ...");
    lblExportChartTo.setBounds(436, 479, 144, 14);
    lblExportChartTo.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    lblExportChartTo.setVisible(false);
    add(lblExportChartTo);

    btnCsv = new JButton("CSV");
    btnCsv.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            JFileChooser fileDialog = new JFileChooser();
            fileDialog.setFileFilter(new FileNameExtensionFilter("*.csv", "csv"));
            fileDialog.showSaveDialog(getParent());
            final File file = fileDialog.getSelectedFile();
            if (file != null) {
                String csv;
                String[] tmpFileName = file.getAbsolutePath().split("\\.");
                if (tmpFileName[tmpFileName.length - 1].equals("csv")) {
                    csv = "";
                } else {
                    csv = ".csv";
                }
                String csvPath = file.getAbsolutePath() + csv;
                OMRoom selectedRoom = (OMRoom) comboBoxRooms.getSelectedItem();
                double[] selectedValues = selectedRoom.getValues();
                File csvFile = new File(csvPath);
                try {
                    FileWriter logWriter = new FileWriter(csvFile);
                    BufferedWriter csvOutput = new BufferedWriter(logWriter);
                    csvOutput.write("\"ID\";\"" + selectedRoom.getId() + "\"");
                    csvOutput.newLine();
                    for (int i = 0; i < selectedValues.length; i++) {
                        csvOutput.write("\"" + i + "\";\"" + (int) selectedValues[i] + "\"");
                        csvOutput.newLine();
                    }
                    JOptionPane.showMessageDialog(null, "CSV saved successfully!\n" + csvPath, "Success",
                            JOptionPane.INFORMATION_MESSAGE);
                    csvOutput.close();
                } catch (IOException ioe) {
                    JOptionPane.showMessageDialog(null,
                            "Failed to write CSV. Please check permissions!\n" + ioe.getMessage(), "Failed",
                            JOptionPane.ERROR_MESSAGE);
                    ioe.printStackTrace();
                }
            } else {
                JOptionPane.showMessageDialog(null, "Failed to write CSV. Please check the file path!",
                        "Failed", JOptionPane.ERROR_MESSAGE);
            }
        }
    });
    btnCsv.setBounds(590, 475, 70, 23);
    btnCsv.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    btnCsv.setVisible(false);
    add(btnCsv);

    btnPdf = new JButton("PDF");
    btnPdf.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            JFileChooser fileDialog = new JFileChooser();
            fileDialog.setFileFilter(new FileNameExtensionFilter("*.pdf", "pdf"));
            fileDialog.showSaveDialog(getParent());
            final File file = fileDialog.getSelectedFile();
            if (file != null) {
                String pdf;
                String[] tmpFileName = file.getAbsolutePath().split("\\.");
                if (tmpFileName[tmpFileName.length - 1].equals("pdf")) {
                    pdf = "";
                } else {
                    pdf = ".pdf";
                }
                String pdfPath = file.getAbsolutePath() + pdf;
                OMBuilding building = (OMBuilding) comboBoxProjects.getSelectedItem();
                String title = building.getName();
                OMRoom selectedRoom = (OMRoom) comboBoxRooms.getSelectedItem();
                JFreeChart chart = OMCharts.createRoomChart(title, selectedRoom, false);
                int height = (int) PageSize.A4.getWidth();
                int width = (int) PageSize.A4.getHeight();
                try {
                    OMExports.exportPdf(pdfPath, chart, width, height, new DefaultFontMapper(), title);
                    JOptionPane.showMessageDialog(null, "PDF saved successfully!\n" + pdfPath, "Success",
                            JOptionPane.INFORMATION_MESSAGE);
                } catch (IOException ioe) {
                    JOptionPane.showMessageDialog(null,
                            "Failed to write PDF. Please check permissions!\n" + ioe.getMessage(), "Failed",
                            JOptionPane.ERROR_MESSAGE);
                    ioe.printStackTrace();
                }
            } else {
                JOptionPane.showMessageDialog(null, "Failed to write PDF. Please check the file path!",
                        "Failed", JOptionPane.ERROR_MESSAGE);
            }
        }
    });
    btnPdf.setBounds(670, 475, 70, 23);
    btnPdf.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    btnPdf.setVisible(false);
    add(btnPdf);

    lblSelectProject = new JLabel("Select Project");
    lblSelectProject.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    lblSelectProject.setBounds(10, 65, 132, 14);
    add(lblSelectProject);

    lblSelectRoom = new JLabel("Select Room");
    lblSelectRoom.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    lblSelectRoom.setBounds(10, 94, 132, 14);
    add(lblSelectRoom);

    panelData = new JPanel();
    panelData.setBounds(10, 118, 730, 347);
    add(panelData);

    btnRefresh = new JButton("Load");
    btnRefresh.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    btnRefresh.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            if (txtOmbFile.getText() != null && !txtOmbFile.getText().equals("")
                    && !txtOmbFile.getText().equals(" ")) {
                txtOmbFile.setBackground(Color.WHITE);
                String ombPath = txtOmbFile.getText();
                String omb;
                String[] tmpFileName = ombPath.split("\\.");
                if (tmpFileName[tmpFileName.length - 1].equals("omb")) {
                    omb = "";
                } else {
                    omb = ".omb";
                }
                txtOmbFile.setText(ombPath + omb);
                setOmbFile(ombPath + omb);
                File ombFile = new File(ombPath + omb);
                if (ombFile.exists()) {
                    txtOmbFile.setBackground(Color.WHITE);
                    btnRefresh.setEnabled(false);
                    comboBoxProjects.setEnabled(false);
                    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                    btnPdf.setVisible(false);
                    btnCsv.setVisible(false);
                    lblExportChartTo.setVisible(false);
                    progressBar.setVisible(true);
                    progressBar.setStringPainted(true);
                    progressBar.setIndeterminate(true);
                    refreshProjectsTask = new RefreshProjects();
                    refreshProjectsTask.execute();
                } else {
                    txtOmbFile.setBackground(new Color(255, 222, 222, 128));
                    JOptionPane.showMessageDialog(null, "OMB-file not found, please check the file path!",
                            "Error", JOptionPane.ERROR_MESSAGE);
                }
            } else {
                txtOmbFile.setBackground(new Color(255, 222, 222, 128));
                JOptionPane.showMessageDialog(null, "Please select an OMB-file!", "Warning",
                        JOptionPane.WARNING_MESSAGE);
            }
        }
    });
    btnRefresh.setBounds(616, 61, 124, 23);
    add(btnRefresh);

    btnMaximize = new JButton("Fullscreen");
    btnMaximize.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    btnMaximize.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            if (comboBoxRooms.isEnabled()) {
                if (comboBoxRooms.getSelectedItem() != null) {
                    OMBuilding building = (OMBuilding) comboBoxProjects.getSelectedItem();
                    String title = building.getName();
                    OMRoom room = (OMRoom) comboBoxRooms.getSelectedItem();
                    panelRoom = createRoomPanel(title, room, false, false);
                    JFrame chartFrame = new JFrame();
                    JPanel chartPanel = createRoomPanel(title, room, false, true);
                    chartFrame.getContentPane().add(chartPanel);
                    chartFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
                    Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
                    chartFrame.setBounds(0, 0, (int) dim.getWidth(), (int) dim.getHeight());
                    chartFrame.setTitle("OM Simulation Tool: " + title + ", Room " + room.getId());
                    chartFrame.setResizable(true);
                    chartFrame.setExtendedState(JFrame.MAXIMIZED_BOTH);
                    chartFrame.setVisible(true);
                }
            }
        }
    });
    btnMaximize.setBounds(10, 475, 124, 23);
    btnMaximize.setVisible(false);
    add(btnMaximize);

    comboBoxProjects = new JComboBox<OMBuilding>();
    comboBoxProjects.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    comboBoxProjects.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            boolean b = false;
            Color c = null;
            if (comboBoxProjects.isEnabled()) {
                if (comboBoxProjects.getSelectedItem() != null) {
                    b = true;
                    c = Color.WHITE;
                    OMBuilding building = (OMBuilding) comboBoxProjects.getSelectedItem();
                    comboBoxRooms.removeAllItems();
                    for (int i = 0; i < building.getRooms().length; i++) {
                        comboBoxRooms.addItem(building.getRooms()[i]);
                    }
                    for (int i = 0; i < building.getCellars().length; i++) {
                        comboBoxRooms.addItem(building.getCellars()[i]);
                    }
                    for (int i = 0; i < building.getMiscs().length; i++) {
                        comboBoxRooms.addItem(building.getMiscs()[i]);
                    }
                } else {
                    b = false;
                    c = null;
                }
            } else {
                b = false;
                c = null;
            }
            lblSelectRoom.setEnabled(b);
            panelData.setEnabled(b);
            btnMaximize.setVisible(b);
            comboBoxRooms.setEnabled(b);
            panelData.setBackground(c);
        }
    });
    comboBoxProjects.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            boolean b = false;
            Color c = null;
            if (comboBoxProjects.isEnabled()) {
                if (comboBoxProjects.getSelectedItem() != null) {
                    b = true;
                    c = Color.WHITE;
                    OMBuilding building = (OMBuilding) comboBoxProjects.getSelectedItem();
                    comboBoxRooms.removeAllItems();
                    for (int i = 0; i < building.getRooms().length; i++) {
                        comboBoxRooms.addItem(building.getRooms()[i]);
                    }
                    for (int i = 0; i < building.getCellars().length; i++) {
                        comboBoxRooms.addItem(building.getCellars()[i]);
                    }
                    for (int i = 0; i < building.getMiscs().length; i++) {
                        comboBoxRooms.addItem(building.getMiscs()[i]);
                    }
                } else {
                    b = false;
                    c = null;
                }
            } else {
                b = false;
                c = null;
            }
            lblSelectRoom.setEnabled(b);
            panelData.setEnabled(b);
            btnMaximize.setVisible(b);
            comboBoxRooms.setEnabled(b);
            panelData.setBackground(c);
        }
    });
    comboBoxProjects.setBounds(152, 61, 454, 22);
    add(comboBoxProjects);

    comboBoxRooms = new JComboBox<OMRoom>();
    comboBoxRooms.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    comboBoxRooms.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            if (comboBoxRooms.isEnabled()) {
                if (comboBoxRooms.getSelectedItem() != null) {
                    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                    remove(panelData);
                    comboBoxRooms.setEnabled(false);
                    refreshChartsTask = new RefreshCharts();
                    refreshChartsTask.execute();
                }
            }
        }
    });
    comboBoxRooms.setBounds(152, 90, 454, 22);
    add(comboBoxRooms);

    progressBar = new JProgressBar();
    progressBar.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    progressBar.setBounds(10, 475, 730, 23);
    progressBar.setVisible(false);
    add(progressBar);

    lblSelectRoom.setEnabled(false);
    panelData.setEnabled(false);
    comboBoxRooms.setEnabled(false);

    lblHelp = new JLabel(
            "Select an OMB-Object file to analyse its data. You can inspect radon concentration for each room.");
    lblHelp.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    lblHelp.setForeground(Color.GRAY);
    lblHelp.setBounds(10, 10, 730, 14);
    add(lblHelp);

    txtOmbFile = new JTextField();
    txtOmbFile.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    txtOmbFile.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent arg0) {
            setOmbFile(txtOmbFile.getText());
        }
    });
    txtOmbFile.setBounds(152, 33, 454, 20);
    add(txtOmbFile);
    txtOmbFile.setColumns(10);

    btnBrowse = new JButton("Browse");
    btnBrowse.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    btnBrowse.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            JFileChooser fileDialog = new JFileChooser();
            fileDialog.setFileFilter(new FileNameExtensionFilter("*.omb", "omb"));
            fileDialog.showOpenDialog(getParent());
            final File file = fileDialog.getSelectedFile();
            if (file != null) {
                String omb;
                String[] tmpFileName = file.getAbsolutePath().split("\\.");
                if (tmpFileName[tmpFileName.length - 1].equals("omb")) {
                    omb = "";
                } else {
                    omb = ".omb";
                }
                txtOmbFile.setText(file.getAbsolutePath() + omb);
                setOmbFile(file.getAbsolutePath() + omb);
            }
        }
    });
    btnBrowse.setBounds(616, 32, 124, 23);
    add(btnBrowse);

    lblSelectOmbfile = new JLabel("Select OMB-File");
    lblSelectOmbfile.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    lblSelectOmbfile.setBounds(10, 36, 132, 14);
    add(lblSelectOmbfile);
}

From source file:md.mclama.com.ModManager.java

/**
 * Create the frame./*from w ww.jav  a  2s .c o  m*/
 */

@SuppressWarnings("serial")
public ModManager() throws MalformedURLException {
    setResizable(false);
    setTitle("McLauncher " + McVersion);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 700, 400);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    tabbedPane.setBounds(0, 0, 694, 372);
    contentPane.add(tabbedPane);

    profileListMdl = new DefaultListModel<String>();
    ModListModel = new DefaultListModel<String>();
    listModel = new DefaultListModel<String>();
    getCurrentMods();

    panelLauncher = new JPanel();
    tabbedPane.addTab("Launcher", null, panelLauncher, null);
    panelLauncher.setLayout(null);
    JScrollPane scrollPane = new JScrollPane();
    scrollPane.setBounds(556, 36, 132, 248);
    panelLauncher.add(scrollPane);
    profileList = new JList<String>(profileListMdl);
    profileList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    scrollPane.setViewportView(profileList);

    btnNewProfile = new JButton("New");
    btnNewProfile.setFont(new Font("SansSerif", Font.PLAIN, 12));
    btnNewProfile.setBounds(479, 4, 76, 20);
    panelLauncher.add(btnNewProfile);
    btnNewProfile.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            newProfile(txtProfile.getText());
        }
    });
    btnNewProfile.setToolTipText("Click to create a new profile.");

    JButton btnRenameProfile = new JButton("Rename");
    btnRenameProfile.setBounds(479, 25, 76, 20);
    panelLauncher.add(btnRenameProfile);
    btnRenameProfile.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            renameProfile();
        }
    });
    btnRenameProfile.setToolTipText("Click to rename the selected profile");

    JButton btnDelProfile = new JButton("Delete");
    btnDelProfile.setBounds(479, 50, 76, 20);
    panelLauncher.add(btnDelProfile);
    btnDelProfile.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            deleteProfile();
        }
    });
    btnDelProfile.setToolTipText("Click to delete the selected profile.");

    JButton btnLaunch = new JButton("Launch");
    btnLaunch.setBounds(605, 319, 89, 23);
    panelLauncher.add(btnLaunch);
    btnLaunch.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (selProfile != null) {
                LaunchFactorioWithSelectedMods(false); //dont ignore
            }
        }
    });
    btnLaunch.setToolTipText("Click to launch factorio with the selected mod profile.");

    lblAvailableMods = new JLabel("Available Mods");
    lblAvailableMods.setBounds(4, 155, 144, 14);
    panelLauncher.add(lblAvailableMods);
    lblAvailableMods.setFont(new Font("SansSerif", Font.PLAIN, 10));

    lblAvailableMods.setText("Available Mods: " + -1);

    txtGamePath = new JTextField();
    txtGamePath.setBounds(4, 5, 211, 23);
    panelLauncher.add(txtGamePath);
    txtGamePath.setToolTipText("Select tha path to your game!");
    txtGamePath.setFont(new Font("Tahoma", Font.PLAIN, 8));
    txtGamePath.setText("Game Path");
    txtGamePath.setColumns(10);

    JButton btnFind = new JButton("find");
    btnFind.setBounds(227, 3, 32, 23);
    panelLauncher.add(btnFind);

    txtProfile = new JTextField();
    txtProfile.setBounds(556, 2, 132, 22);
    panelLauncher.add(txtProfile);
    txtProfile.setToolTipText("The name of NEW or RENAME profiles");
    txtProfile.setText("Profile1");
    txtProfile.setColumns(10);

    lblModsEnabled = new JLabel("Mods Enabled: -1");
    lblModsEnabled.setBounds(335, 155, 95, 16);
    panelLauncher.add(lblModsEnabled);
    lblModsEnabled.setFont(new Font("SansSerif", Font.PLAIN, 10));

    JScrollPane scrollPane_1 = new JScrollPane();
    scrollPane_1.setBounds(0, 167, 211, 165);
    panelLauncher.add(scrollPane_1);
    modsList = new JList<String>(listModel);
    modsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    modsList.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseReleased(MouseEvent e) {
            String modName = util.getModVersion(modsList.getSelectedValue());
            lblModVersion.setText("Mod Version: " + modName);
            checkDependency(modsList);
            if (modName.contains(".zip")) {
                new File(System.getProperty("java.io.tmpdir") + modName.replace(".zip", "")).delete();
            }
            if (System.currentTimeMillis() - lastClickTime <= 300) { //Double click
                addMod();
            }
            lastClickTime = System.currentTimeMillis();
        }
    });
    scrollPane_1.setViewportView(modsList);
    modsList.setFont(new Font("Tahoma", Font.PLAIN, 9));

    JScrollPane scrollPane_2 = new JScrollPane();
    scrollPane_2.setBounds(333, 167, 211, 165);
    panelLauncher.add(scrollPane_2);
    enabledModsList = new JList<String>(ModListModel);
    enabledModsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    enabledModsList.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseReleased(MouseEvent e) {
            lblModVersion.setText("Mod Version: " + util.getModVersion(enabledModsList.getSelectedValue()));
            checkDependency(enabledModsList);
            if (System.currentTimeMillis() - lastClickTime <= 300) { //Double click
                removeMod();
            }
            lastClickTime = System.currentTimeMillis();
        }
    });
    enabledModsList.setFont(new Font("SansSerif", Font.PLAIN, 10));
    scrollPane_2.setViewportView(enabledModsList);

    JButton btnEnable = new JButton("Enable");
    btnEnable.setBounds(223, 200, 90, 28);
    panelLauncher.add(btnEnable);
    btnEnable.setToolTipText("Add mod -->");

    JButton btnDisable = new JButton("Disable");
    btnDisable.setBounds(223, 240, 90, 28);
    panelLauncher.add(btnDisable);
    btnDisable.setToolTipText("Disable mod ");

    JLabel lblModsAvailable = new JLabel("Mods available");
    lblModsAvailable.setBounds(4, 329, 89, 14);
    panelLauncher.add(lblModsAvailable);
    lblModsAvailable.setFont(new Font("SansSerif", Font.PLAIN, 10));

    JLabel lblEnabledMods = new JLabel("Enabled Mods");
    lblEnabledMods.setBounds(337, 329, 89, 16);
    panelLauncher.add(lblEnabledMods);
    lblEnabledMods.setFont(new Font("SansSerif", Font.PLAIN, 10));

    lblModVersion = new JLabel("Mod Version: (select a mod first)");
    lblModVersion.setBounds(4, 117, 183, 14);
    panelLauncher.add(lblModVersion);
    lblModVersion.setFont(new Font("SansSerif", Font.PLAIN, 10));

    lblRequiredMods = new JLabel("Required Mods: " + reqModsStr);
    lblRequiredMods.setBounds(6, 143, 538, 14);
    panelLauncher.add(lblRequiredMods);
    lblRequiredMods.setHorizontalAlignment(SwingConstants.RIGHT);
    lblRequiredMods.setFont(new Font("SansSerif", Font.PLAIN, 10));

    JButton btnNewButton = new JButton("TEST");
    btnNewButton.setVisible(testBtnEnabled);
    btnNewButton.setEnabled(testBtnEnabled);
    btnNewButton.setBounds(338, 61, 90, 28);
    panelLauncher.add(btnNewButton);
    btnUpdate.setBounds(218, 322, 103, 20);
    panelLauncher.add(btnUpdate);

    btnUpdate.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            util.updateLauncher();
        }
    });
    btnUpdate.setVisible(false);
    btnUpdate.setFont(new Font("SansSerif", Font.PLAIN, 9));

    lblModRequires = new JLabel("Mod Requires: (Select a mod first)");
    lblModRequires.setBounds(4, 127, 317, 16);
    panelLauncher.add(lblModRequires);

    btnLaunchIgnore = new JButton("Launch + ignore");
    btnLaunchIgnore.setToolTipText("Ignore any errors that McLauncher may not correctly account for.");
    btnLaunchIgnore.setFont(new Font("SansSerif", Font.PLAIN, 11));
    btnLaunchIgnore.setBounds(556, 284, 133, 23);
    panelLauncher.add(btnLaunchIgnore);

    JButton btnConsole = new JButton("Console");
    btnConsole.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            boolean changeto = !con.isVisible();
            con.setVisible(changeto);
            con.updateConsole();
        }
    });
    btnConsole.setBounds(335, 0, 90, 28);
    panelLauncher.add(btnConsole);

    JPanel panelDownloadMods = new JPanel();
    tabbedPane.addTab("Download Mods", null, panelDownloadMods, null);
    panelDownloadMods.setLayout(null);

    scrollPane_3 = new JScrollPane();
    scrollPane_3.setBounds(0, 0, 397, 303);
    panelDownloadMods.add(scrollPane_3);

    dlModel = new DefaultTableModel(new Object[][] {},
            new String[] { "Mod Name", "Author", "Version", "Tags" }) {
        Class[] columnTypes = new Class[] { String.class, String.class, String.class, Object.class };

        public Class getColumnClass(int columnIndex) {
            return columnTypes[columnIndex];
        }

        boolean[] columnEditables = new boolean[] { false, false, false, false };

        public boolean isCellEditable(int row, int column) {
            return columnEditables[column];
        };
    };

    tSorter = new TableRowSorter<DefaultTableModel>(dlModel);
    tableDownloads = new JTable();
    tableDownloads.setRowSorter(tSorter);
    tableDownloads.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseReleased(MouseEvent e) {
            trow = tableDownloads.getSelectedRow();
            trow = tableDownloads.getRowSorter().convertRowIndexToModel(trow);
            getDlModData();
            canDownloadMod = true;
        }
    });
    tableDownloads.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            trow = tableDownloads.getSelectedRow();
            trow = tableDownloads.getRowSorter().convertRowIndexToModel(trow);
            getDlModData();
            canDownloadMod = true;
        }
    });
    tableDownloads.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
    tableDownloads.setShowVerticalLines(true);
    tableDownloads.setShowHorizontalLines(true);
    tableDownloads.setModel(dlModel);
    tableDownloads.getColumnModel().getColumn(0).setPreferredWidth(218);
    tableDownloads.getColumnModel().getColumn(1).setPreferredWidth(97);
    tableDownloads.getColumnModel().getColumn(2).setPreferredWidth(77);
    scrollPane_3.setViewportView(tableDownloads);

    btnDownload = new JButton("Download");
    btnDownload.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (canDownloadMod && !CurrentlyDownloading) {
                String dlUrl = getModDownloadUrl();
                try {
                    if (dlUrl.equals("") || dlUrl.equals(" ") || dlUrl == null) {
                        con.log("Log", "No download link for mod, got... '" + dlUrl + "'");
                    } else {
                        CurrentlyDownloading = true;
                        CurrentDownload = new Download(new URL(dlUrl), McLauncher);
                    }
                } catch (MalformedURLException e1) {
                    con.log("Log", "Failed to download mod... No download URL?");
                }
            }
        }
    });
    btnDownload.setBounds(307, 308, 90, 28);
    panelDownloadMods.add(btnDownload);

    btnGotoMod = new JButton("Mod Page");
    btnGotoMod.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            util.openWebpage(modPageUrl);
        }
    });
    btnGotoMod.setEnabled(false);
    btnGotoMod.setBounds(134, 308, 90, 28);
    panelDownloadMods.add(btnGotoMod);

    pBarDownloadMod = new JProgressBar();
    pBarDownloadMod.setBounds(538, 308, 150, 10);
    panelDownloadMods.add(pBarDownloadMod);

    pBarExtractMod = new JProgressBar();
    pBarExtractMod.setBounds(538, 314, 150, 10);
    panelDownloadMods.add(pBarExtractMod);

    lblDownloadModInfo = new JLabel("Download progress");
    lblDownloadModInfo.setBounds(489, 326, 199, 16);
    panelDownloadMods.add(lblDownloadModInfo);
    lblDownloadModInfo.setHorizontalAlignment(SwingConstants.TRAILING);

    panelModImg = new JPanel();
    panelModImg.setBounds(566, 0, 128, 128);
    panelDownloadMods.add(panelModImg);

    txtFilterText = new JTextField();
    txtFilterText.addFocusListener(new FocusAdapter() {
        @Override
        public void focusGained(FocusEvent e) {
            if (txtFilterText.getText().equals("Filter Text")) {
                txtFilterText.setText("");
                newFilter();
            }
        }
    });
    txtFilterText.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            if (!txtFilterText.getText().equals("Filter Text")) {
                newFilter();
            }
        }
    });
    txtFilterText.setText("Filter Text");
    txtFilterText.setBounds(0, 308, 122, 28);
    panelDownloadMods.add(txtFilterText);
    txtFilterText.setColumns(10);

    comboBox = new JComboBox();
    comboBox.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            newFilter();
        }
    });
    comboBox.setModel(new DefaultComboBoxModel(new String[] { "No tag filter", "Vanilla", "Machine", "Mechanic",
            "New Ore", "Module", "Big Mod", "Power", "GUI", "Map-Gen", "Must-Have", "Equipment" }));
    comboBox.setBounds(403, 44, 150, 26);
    panelDownloadMods.add(comboBox);

    lblModDlCounter = new JLabel("Mod database: ");
    lblModDlCounter.setFont(new Font("SansSerif", Font.PLAIN, 10));
    lblModDlCounter.setBounds(403, 5, 162, 16);
    panelDownloadMods.add(lblModDlCounter);

    txtrDMModDescription = new JTextArea();
    txtrDMModDescription.setBackground(Color.LIGHT_GRAY);
    txtrDMModDescription.setBorder(new LineBorder(new Color(0, 0, 0)));
    txtrDMModDescription.setFocusable(false);
    txtrDMModDescription.setEditable(false);
    txtrDMModDescription.setLineWrap(true);
    txtrDMModDescription.setWrapStyleWord(true);
    txtrDMModDescription.setText("Mod Description: ");
    txtrDMModDescription.setBounds(403, 132, 285, 75);
    panelDownloadMods.add(txtrDMModDescription);

    lblDMModTags = new JTextArea();
    lblDMModTags.setFocusable(false);
    lblDMModTags.setEditable(false);
    lblDMModTags.setBorder(new LineBorder(new Color(0, 0, 0)));
    lblDMModTags.setWrapStyleWord(true);
    lblDMModTags.setLineWrap(true);
    lblDMModTags.setBackground(Color.LIGHT_GRAY);
    lblDMModTags.setText("Mod Tags: ");
    lblDMModTags.setBounds(403, 71, 160, 60);
    panelDownloadMods.add(lblDMModTags);

    lblDMRequiredMods = new JTextArea();
    lblDMRequiredMods.setFocusable(false);
    lblDMRequiredMods.setEditable(false);
    lblDMRequiredMods.setText("Required Mods: ");
    lblDMRequiredMods.setWrapStyleWord(true);
    lblDMRequiredMods.setLineWrap(true);
    lblDMRequiredMods.setBorder(new LineBorder(new Color(0, 0, 0)));
    lblDMRequiredMods.setBackground(Color.LIGHT_GRAY);
    lblDMRequiredMods.setBounds(403, 208, 285, 57);
    panelDownloadMods.add(lblDMRequiredMods);

    lblDLModLicense = new JLabel("");
    lblDLModLicense.setHorizontalAlignment(SwingConstants.RIGHT);
    lblDLModLicense.setBounds(403, 294, 285, 16);
    panelDownloadMods.add(lblDLModLicense);

    lblWipmod = new JLabel("");
    lblWipmod.setBounds(395, 314, 64, 16);
    panelDownloadMods.add(lblWipmod);

    JButton btnCancel = new JButton("Cancel");
    btnCancel.setToolTipText("Stop downloading");
    btnCancel.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            CurrentDownload.cancel();
        }
    });
    btnCancel.setBounds(230, 308, 72, 28);
    panelDownloadMods.add(btnCancel);

    panelOptions = new JPanel();
    tabbedPane.addTab("Options", null, panelOptions, null);
    panelOptions.setLayout(null);
    scrollPane_4.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane_4.setBounds(0, 0, 694, 342);
    panelOptions.add(scrollPane_4);

    panel = new JPanel();
    scrollPane_4.setViewportView(panel);
    panel.setLayout(null);

    lblCloseMclauncherAfter = new JLabel("Close McLauncher after launching Factorio?");
    lblCloseMclauncherAfter.setBounds(6, 6, 274, 16);
    panel.add(lblCloseMclauncherAfter);

    lblCloseMclauncherAfter_1 = new JLabel("Close McLauncher after updating?");
    lblCloseMclauncherAfter_1.setBounds(6, 34, 274, 16);
    panel.add(lblCloseMclauncherAfter_1);

    lblSortNewestDownloadable = new JLabel("Sort newest downloadable mods first?");
    lblSortNewestDownloadable.setBounds(6, 62, 274, 16);
    panel.add(lblSortNewestDownloadable);

    tglbtnNewModsFirst = new JToggleButton("Toggle");
    tglbtnNewModsFirst.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            lblNeedrestart.setText("McLauncher needs to restart for that to work");
            writeData();
        }
    });
    tglbtnNewModsFirst.setSelected(true);
    tglbtnNewModsFirst.setBounds(281, 56, 66, 28);
    panel.add(tglbtnNewModsFirst);

    tglbtnCloseAfterUpdate = new JToggleButton("Toggle");
    tglbtnCloseAfterUpdate.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            writeData();
        }
    });
    tglbtnCloseAfterUpdate.setBounds(281, 28, 66, 28);
    panel.add(tglbtnCloseAfterUpdate);

    tglbtnCloseAfterLaunch = new JToggleButton("Toggle");
    tglbtnCloseAfterLaunch.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            writeData();
        }
    });
    tglbtnCloseAfterLaunch.setBounds(281, 0, 66, 28);
    panel.add(tglbtnCloseAfterLaunch);

    tglbtnDisplayon = new JToggleButton("On");
    tglbtnDisplayon.setFont(new Font("SansSerif", Font.PLAIN, 10));
    tglbtnDisplayon.setSelected(true);
    tglbtnDisplayon.setBounds(588, 308, 44, 28);
    panel.add(tglbtnDisplayon);

    tglbtnDisplayoff = new JToggleButton("Off");
    tglbtnDisplayoff.setFont(new Font("SansSerif", Font.PLAIN, 10));
    tglbtnDisplayoff.setBounds(644, 308, 44, 28);
    panel.add(tglbtnDisplayoff);

    lblInfo = new JLabel("What enabled and disabled look like");
    lblInfo.setFont(new Font("SansSerif", Font.PLAIN, 10));
    lblInfo.setHorizontalAlignment(SwingConstants.TRAILING);
    lblInfo.setBounds(359, 314, 231, 16);
    panel.add(lblInfo);

    JSeparator separator = new JSeparator();
    separator.setBounds(6, 55, 676, 24);
    panel.add(separator);

    JSeparator separator_1 = new JSeparator();
    separator_1.setBounds(6, 27, 676, 18);
    panel.add(separator_1);

    JSeparator separator_2 = new JSeparator();
    separator_2.setBounds(6, 84, 676, 24);
    panel.add(separator_2);

    JSeparator separator_3 = new JSeparator();
    separator_3.setOrientation(SwingConstants.VERTICAL);
    separator_3.setBounds(346, 0, 16, 336);
    panel.add(separator_3);

    lblNeedrestart = new JLabel("");
    lblNeedrestart.setBounds(6, 314, 341, 16);
    panel.add(lblNeedrestart);

    tglbtnSendAnonData = new JToggleButton("Toggle");
    tglbtnSendAnonData.setToolTipText("Information regarding the activity of McLauncher.");
    tglbtnSendAnonData.setSelected(true); //set enabled by default.
    tglbtnSendAnonData.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            writeData();
        }
    });
    tglbtnSendAnonData.setBounds(622, 0, 66, 28);
    panel.add(tglbtnSendAnonData);

    lblSendAnonymousUse = new JLabel("Send anonymous use data?");
    lblSendAnonymousUse.setBounds(359, 6, 251, 16);
    panel.add(lblSendAnonymousUse);

    lblDeleteOldMod = new JLabel("Delete old mod before updating?");
    lblDeleteOldMod.setBounds(359, 34, 251, 16);
    panel.add(lblDeleteOldMod);

    tglbtnDeleteBeforeUpdate = new JToggleButton("Toggle");
    tglbtnDeleteBeforeUpdate.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            writeData();
        }
    });
    tglbtnDeleteBeforeUpdate.setBounds(622, 28, 66, 28);
    panel.add(tglbtnDeleteBeforeUpdate);

    tglbtnAlertOnModUpdateAvailable = new JToggleButton("Toggle");
    tglbtnAlertOnModUpdateAvailable.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            writeData();
        }
    });
    tglbtnAlertOnModUpdateAvailable.setSelected(true);
    tglbtnAlertOnModUpdateAvailable.setBounds(281, 86, 66, 28);
    panel.add(tglbtnAlertOnModUpdateAvailable);

    separator_4 = new JSeparator();
    separator_4.setBounds(0, 112, 676, 24);
    panel.add(separator_4);

    JLabel lblAlertModHas = new JLabel("Alert mod has update on launch?");
    lblAlertModHas.setBounds(6, 92, 231, 16);
    panel.add(lblAlertModHas);

    panelChangelog = new JPanel();
    tabbedPane.addTab("Changelog", null, panelChangelog, null);
    panelChangelog.setLayout(new BoxLayout(panelChangelog, BoxLayout.X_AXIS));

    scrollPane_6 = new JScrollPane();
    panelChangelog.add(scrollPane_6);

    textChangelog = new JTextArea();
    scrollPane_6.setViewportView(textChangelog);
    textChangelog.setEditable(false);
    textChangelog.setText(
            "v0.4.6\r\n\r\n+Fix problem where config file would not save in the correct location. (Thanks Arano-kai)\r\n+McLauncher will now save when you select a path, or profile. (Thanks Arano-kai)\r\n+Fixed an issue where McLauncher could not get the version from a .zip mod. (Thanks Arano-kai)\r\n+Added a Cancel button to stop downloading the current mod. (Suggested by  Arano-kai)\r\n\r\n\r\n\r\nv0.4.5\r\n\r\n+McLauncher should now correctly warn you on failed write/read access.\r\n+McLauncher should now work when a user has both zip and installer versions of factorio. (Thanks Jeroon)\r\n+Attempt to fix an error with dependency and .zip files, With versions. (Thanks Arano-kai)\r\n+Fix only allow single selection of mods. (Thanks Arano-kai)\r\n+Fix for the Launch+Ignore button problem on linux being cut off. (Thanks Arano-kai)\r\n+Display download progress.\r\n+Fixed an error that was thrown when clicking on some mods that had a single dependency mod.\r\n+Double clicking on a mod will now enable or disable the mod. (Thanks Arano-kai)");
    btnLaunchIgnore.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (selProfile != null) {
                LaunchFactorioWithSelectedMods(true); //ignore errors, launch.
            }
        }
    });
    btnLaunchIgnore.setVisible(false);
    //This is my test button. I use this to test things then implement them into the swing.
    btnNewButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            testButtonCode(e);
        }
    });
    //Disable mods button. (from profile)
    btnDisable.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            removeMod();
        }
    });
    //Enable mods button. (to profile)
    btnEnable.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            addMod();
        }
    });
    //Game path button
    btnFind.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            findPath();
        }
    });
    //mouseClick event lister for when you click on a new profile
    profileList.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            selectedProfile();
        }
    });

    readData(); //Load settings

    init(); //some extra init
    getMods(); //Get the mods the user has installed
}

From source file:org.fhaes.fhsamplesize.view.FHSampleSize.java

/**
 * Initialize GUI components.//w  w w  .j  a  va 2 s. c  om
 */
@SuppressWarnings({ "rawtypes", "unchecked" })
private void initGUI() {

    App.init();

    // setBounds(100, 100, 972, 439);
    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    setIconImage(Builder.getApplicationIcon());
    setTitle("Sample Size Analysis");
    getContentPane().setLayout(new MigLayout("", "[1136px,grow,fill]", "[30px][405px,grow]"));

    JToolBar toolBar = new JToolBar();
    toolBar.setFloatable(false);
    getContentPane().add(toolBar, "cell 0 0,growx,aligny top");

    JToolBarButton btnOpen = new JToolBarButton(actionBrowse);
    btnOpen.setIcon(Builder.getImageIcon("fileopen.png"));
    toolBar.add(btnOpen);

    JToolBarButton btnSave = new JToolBarButton(actionSaveTable);
    btnSave.setIcon(Builder.getImageIcon("save.png"));
    toolBar.add(btnSave);

    JToolBarButton btnExportPDF = new JToolBarButton(actionExportPDF);
    btnExportPDF.setIcon(Builder.getImageIcon("pdf.png"));
    toolBar.add(btnExportPDF);

    JToolBarButton btnExportPNG = new JToolBarButton(actionExportPNG);
    btnExportPNG.setIcon(Builder.getImageIcon("formatpng.png"));
    toolBar.add(btnExportPNG);

    toolBar.addSeparator();

    JToolBarButton btnRun = new JToolBarButton(actionRun);
    btnRun.setIcon(Builder.getImageIcon("run.png"));
    toolBar.add(btnRun);

    JPanel panelMain = new JPanel();
    getContentPane().add(panelMain, "cell 0 1,grow");
    panelMain.setLayout(new BorderLayout(0, 0));

    JSplitPane splitPaneMain = new JSplitPane();
    splitPaneMain.setOneTouchExpandable(true);
    panelMain.add(splitPaneMain);

    JPanel panelParameters = new JPanel();
    splitPaneMain.setLeftComponent(panelParameters);
    panelParameters.setLayout(new MigLayout("", "[grow,right]", "[][][][193.00,grow,fill][]"));

    JPanel panelInput = new JPanel();
    panelInput.setBorder(new TitledBorder(null, "Input", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    panelParameters.add(panelInput, "cell 0 0,grow");
    panelInput.setLayout(new MigLayout("", "[100px:100px:180px,right][grow,fill][]", "[]"));

    JLabel lblInputFile = new JLabel("Input file:");
    panelInput.add(lblInputFile, "cell 0 0");

    txtInputFile = new JTextField();
    panelInput.add(txtInputFile, "cell 1 0,growx");
    txtInputFile.setActionCommand("NewFileTyped");
    txtInputFile.addActionListener(this);
    txtInputFile.setColumns(10);

    JButton btnBrowse = new JButton("");
    panelInput.add(btnBrowse, "cell 2 0");
    btnBrowse.setAction(actionBrowse);
    btnBrowse.setText("");
    btnBrowse.setIcon(Builder.getImageIcon("fileopen16.png"));
    btnBrowse.setPreferredSize(new Dimension(25, 25));
    btnBrowse.setMaximumSize(new Dimension(25, 25));
    btnBrowse.putClientProperty("JButton.buttonType", "segmentedTextured");
    btnBrowse.putClientProperty("JButton.segmentPosition", "middle");

    JPanel panelAnalysisOptions = new JPanel();
    panelAnalysisOptions.setBorder(new TitledBorder(null, "Analysis and filtering options",
            TitledBorder.LEADING, TitledBorder.TOP, null, null));
    panelParameters.add(panelAnalysisOptions, "cell 0 1,grow");
    panelAnalysisOptions.setLayout(new MigLayout("", "[100px:100px:180px,right][grow][][]", "[][][][][]"));

    JLabel lblEventTypes = new JLabel("Event type:");
    panelAnalysisOptions.add(lblEventTypes, "cell 0 0");

    cboEventType = new JComboBox();
    panelAnalysisOptions.add(cboEventType, "cell 1 0 3 1");
    cboEventType.setModel(new DefaultComboBoxModel(EventTypeToProcess.values()));
    new EventTypeWrapper(cboEventType, PrefKey.EVENT_TYPE_TO_PROCESS, EventTypeToProcess.FIRE_EVENT);

    chkCommonYears = new JCheckBox("<html>Only analyze years all series have in common");
    chkCommonYears.setEnabled(false);
    new CheckBoxWrapper(chkCommonYears, PrefKey.SSIZ_CHK_COMMON_YEARS, false);
    panelAnalysisOptions.add(chkCommonYears, "cell 1 1 3 1");

    chkExcludeSeriesWithNoEvents = new JCheckBox("<html>Exclude series/segments with no events");
    chkExcludeSeriesWithNoEvents.setEnabled(false);
    new CheckBoxWrapper(chkExcludeSeriesWithNoEvents, PrefKey.SSIZ_CHK_EXCLUDE_SERIES_WITH_NO_EVENTS, false);
    panelAnalysisOptions.add(chkExcludeSeriesWithNoEvents, "cell 1 2 3 1");

    JLabel lblThresholdType = new JLabel("Threshold:");
    panelAnalysisOptions.add(lblThresholdType, "cell 0 3");

    cboThresholdType = new JComboBox();
    panelAnalysisOptions.add(cboThresholdType, "cell 1 3");
    cboThresholdType.setModel(new DefaultComboBoxModel(FireFilterType.values()));
    new FireFilterTypeWrapper(cboThresholdType, PrefKey.COMPOSITE_FILTER_TYPE_WITH_ALL_TREES,
            FireFilterType.NUMBER_OF_EVENTS);

    JLabel label = new JLabel(">=");
    panelAnalysisOptions.add(label, "flowx,cell 2 3");

    spnThresholdValueGT = new JSpinner();
    panelAnalysisOptions.add(spnThresholdValueGT, "cell 3 3");
    spnThresholdValueGT.setModel(new SpinnerNumberModel(1, 1, 999, 1));
    new SpinnerWrapper(spnThresholdValueGT, PrefKey.COMPOSITE_FILTER_VALUE, 1);

    chkEnableLessThan = new JCheckBox("");
    chkEnableLessThan.setActionCommand("LessThanThresholdStatus");
    chkEnableLessThan.addActionListener(this);
    panelAnalysisOptions.add(chkEnableLessThan, "flowx,cell 1 4,alignx right");

    lblLessThan = new JLabel("<=");
    lblLessThan.setEnabled(false);
    panelAnalysisOptions.add(lblLessThan, "cell 2 4");

    spnThresholdValueLT = new JSpinner();
    spnThresholdValueLT.setEnabled(false);
    spnThresholdValueLT.setModel(new SpinnerNumberModel(1, 1, 999, 1));
    panelAnalysisOptions.add(spnThresholdValueLT, "cell 3 4");

    lblAnd = new JLabel("and");
    panelAnalysisOptions.add(lblAnd, "cell 1 4");

    JPanel panelSimulations = new JPanel();
    panelSimulations.setBorder(
            new TitledBorder(null, "Simulations", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    panelParameters.add(panelSimulations, "cell 0 2,grow");
    panelSimulations.setLayout(new MigLayout("", "[100px:100px:180px,right][fill]", "[][][]"));

    JLabel lblSimulations = new JLabel("Simulations:");
    panelSimulations.add(lblSimulations, "cell 0 0");

    spnSimulations = new JSpinner();
    panelSimulations.add(spnSimulations, "cell 1 0");
    spnSimulations.setModel(new SpinnerNumberModel(new Integer(1000), new Integer(1), null, new Integer(1)));
    new SpinnerWrapper(spnSimulations, PrefKey.SSIZ_SIMULATION_COUNT, 1000);

    JLabel lblSeedNumber = new JLabel("Seed number:");
    panelSimulations.add(lblSeedNumber, "cell 0 1");

    spnSeed = new JSpinner();
    panelSimulations.add(spnSeed, "cell 1 1");
    spnSeed.setModel(new SpinnerNumberModel(new Integer(30188), null, null, new Integer(1)));
    new SpinnerWrapper(spnSeed, PrefKey.SSIZ_SEED_NUMBER, 30188);

    JLabel lblResampling = new JLabel("Resampling:");
    panelSimulations.add(lblResampling, "cell 0 2");

    cboResampling = new JComboBox();
    panelSimulations.add(cboResampling, "cell 1 2");
    cboResampling
            .setModel(new DefaultComboBoxModel(new String[] { "With replacement", "Without replacement" }));
    new ResamplingTypeWrapper(cboResampling, PrefKey.SSIZ_RESAMPLING_TYPE, ResamplingType.WITH_REPLACEMENT);

    segmentationPanel = new SegmentationPanel();
    segmentationPanel.chkSegmentation.setText("Process subset or segments of dataset?");
    segmentationPanel.chkSegmentation.setEnabled(false);
    panelParameters.add(segmentationPanel, "cell 0 3,growx");

    JPanel panel_3 = new JPanel();
    panelParameters.add(panel_3, "cell 0 4,grow");
    panel_3.setLayout(new MigLayout("", "[left][grow][right]", "[]"));

    JButton btnReset = new JButton("Reset");
    btnReset.setActionCommand("Reset");
    btnReset.addActionListener(this);
    panel_3.add(btnReset, "cell 0 0,grow");

    JButton btnRunAnalysis = new JButton("Run Analysis");
    btnRunAnalysis.setAction(actionRun);
    panel_3.add(btnRunAnalysis, "cell 2 0,grow");

    JPanel panelResults = new JPanel();
    splitPaneMain.setRightComponent(panelResults);
    panelResults.setLayout(new BorderLayout(0, 0));

    splitPaneResults = new JSplitPane();
    splitPaneResults.setResizeWeight(0.5);
    splitPaneResults.setOneTouchExpandable(true);
    splitPaneResults.setDividerLocation(0.5d);
    panelResults.add(splitPaneResults, BorderLayout.CENTER);
    splitPaneResults.setOrientation(JSplitPane.VERTICAL_SPLIT);

    JPanel panelResultsTop = new JPanel();
    splitPaneResults.setLeftComponent(panelResultsTop);
    panelResultsTop.setLayout(new BorderLayout(0, 0));

    JPanel panelChartOptions = new JPanel();
    panelChartOptions.setBackground(Color.WHITE);
    panelResultsTop.add(panelChartOptions, BorderLayout.SOUTH);
    panelChartOptions.setLayout(new MigLayout("", "[][][][][][grow][grow]", "[15px,center]"));

    JLabel lblNewLabel = new JLabel("Plot:");
    panelChartOptions.add(lblNewLabel, "cell 0 0,alignx trailing,aligny center");

    cboChartMetric = new JComboBox();
    cboChartMetric.setEnabled(false);
    cboChartMetric.setModel(new DefaultComboBoxModel(MiddleMetric.values()));
    panelChartOptions.add(cboChartMetric, "cell 1 0,growx");
    cboChartMetric.setBackground(Color.WHITE);

    JLabel lblOfSegment = new JLabel("of segment:");
    panelChartOptions.add(lblOfSegment, "cell 2 0,alignx trailing");

    cboSegment = new JComboBox();
    cboSegment.setBackground(Color.WHITE);
    cboSegment.setActionCommand("UpdateChart");
    cboSegment.addActionListener(this);

    panelChartOptions.add(cboSegment, "cell 3 0,growx");
    cboChartMetric.setActionCommand("UpdateChart");

    JLabel lblWithAsymptoteType = new JLabel("with asymptote type:");
    panelChartOptions.add(lblWithAsymptoteType, "cell 4 0,alignx trailing");

    JComboBox comboBox = new JComboBox();
    comboBox.setEnabled(false);
    comboBox.setModel(new DefaultComboBoxModel(new String[] { "none", "Weibull", "Michaelis-Menten",
            "Modified Michaelis-Menten", "Logistic", "Modified exponential" }));
    comboBox.setBackground(Color.WHITE);
    panelChartOptions.add(comboBox, "cell 5 0,growx");
    cboChartMetric.addActionListener(this);

    panelChart = new JPanel();
    panelChart.setMinimumSize(new Dimension(200, 200));
    panelResultsTop.add(panelChart, BorderLayout.CENTER);
    panelChart.setLayout(new BorderLayout(0, 0));
    panelChart.setBackground(Color.WHITE);

    JTabbedPane panelResultsBottom = new JTabbedPane(JTabbedPane.BOTTOM);
    splitPaneResults.setRightComponent(panelResultsBottom);

    simulationsTable = new SSIZResultsTable();
    simulationsTable.setEnabled(false);
    simulationsTable.addMouseListener(new TablePopClickListener());
    simulationsTable.setVisibleRowCount(10);

    adapter = new JTableSpreadsheetByRowAdapter(simulationsTable);

    scrollPaneSimulations = new JScrollPane();
    panelResultsBottom.addTab("Simulations", null, scrollPaneSimulations, null);
    scrollPaneSimulations.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scrollPaneSimulations.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    scrollPaneSimulations.setViewportView(simulationsTable);

    JPanel panelAsymptote = new JPanel();

    asymptoteTable = new AsymptoteTable();
    asymptoteTable.setEnabled(false);
    // asymptoteTable.addMouseListener(new TablePopClickListener());
    asymptoteTable.setVisibleRowCount(10);

    scrollPaneAsymptote = new JScrollPane();

    scrollPaneAsymptote.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scrollPaneAsymptote.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    scrollPaneAsymptote.setViewportView(asymptoteTable);
    panelAsymptote.setLayout(new BorderLayout());
    panelAsymptote.add(scrollPaneAsymptote, BorderLayout.CENTER);
    panelResultsBottom.addTab("Asymptote", null, panelAsymptote, null);

    // Disable asymptote tab until it is implemented
    panelResultsBottom.setEnabledAt(1, false);

    panelProgressBar = new JPanel();
    panelProgressBar.setLayout(new BorderLayout());

    btnCancelAnalysis = new JButton("Cancel");
    btnCancelAnalysis.setIcon(Builder.getImageIcon("delete.png"));
    btnCancelAnalysis.setVisible(false);
    btnCancelAnalysis.setActionCommand("CancelAnalysis");
    btnCancelAnalysis.addActionListener(this);

    progressBar = new JProgressBar();
    panelProgressBar.add(progressBar, BorderLayout.CENTER);
    panelProgressBar.add(btnCancelAnalysis, BorderLayout.EAST);
    progressBar.setStringPainted(true);

    fileDialogWasUsed = false;
    mouseListenersActive = false;

    this.setGUIForFHFileReader();
    this.setGUIForThresholdStatus();

    pack();
    this.setExtendedState(this.getExtendedState() | JFrame.MAXIMIZED_BOTH);
    setVisible(true);
}

From source file:hpssim.grafica.HPSsim.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY
    // //GEN-BEGIN:initComponents
    // Generated using JFormDesigner Evaluation license - Lgc M
    DefaultComponentFactory compFactory = DefaultComponentFactory.getInstance();
    HPSsimWindow = new JFrame();
    hpssimWindow = new JPanel();
    hpssimTab = new JTabbedPane();
    panelConfiguration = new JPanel();
    label10 = new JLabel();
    label3 = new JLabel();
    ncpu = new JTextField();
    label4 = new JLabel();
    ngpu = new JTextField();
    vSpacer1 = new JPanel(null);
    label11 = new JLabel();
    label2 = new JLabel();
    sliderSimulationTime = new JSlider();
    textFieldSimTime = new JLabel();
    label1 = new JLabel();
    sliderJob = new JSlider();
    textFieldNjob = new JLabel();
    label9 = new JLabel();
    textFieldQVGA = new JTextField();
    label43 = new JLabel();
    tex_mediaexe = new JTextField();
    checkBoxEndJob = new JCheckBox();
    label6 = new JLabel();
    comboBoxScheduler = new JComboBox<>();
    label8 = new JLabel();
    textFieldTimeSlice = new JTextField();
    label7 = new JLabel();
    comboBoxQueue = new JComboBox<>();
    vSpacer2 = new JPanel(null);
    label21 = new JLabel();
    sliderclassRate = new JSlider();
    labelclassRate = new JLabel();
    label12 = new JLabel();
    sliderRTJob = new JSlider();
    labelRT = new JLabel();
    label14 = new JLabel();
    sliderOpenCl = new JSlider();
    labelOPENCL = new JLabel();
    checkBox_enableLog = new JCheckBox();
    panelPerformance = new JPanel();
    separator1 = new JSeparator();
    tabbedPane1 = new JTabbedPane();
    panelCPU = new JPanel();
    labelCPUUsage = new JLabel();
    panelCPUQueue = new JPanel();
    tabbedPane2 = new JTabbedPane();
    panelGPU = new JPanel();
    labelGPUUsage = new JLabel();
    panelGPUQueue = new JPanel();
    panel2 = new JPanel();
    label18 = new JLabel();
    virtualTime = new JTextField();
    label5 = new JLabel();
    processiNelSistema = new JTextField();
    label17 = new JLabel();
    processiElaborazione = new JTextField();
    label16 = new JLabel();
    processiInCoda = new JTextField();
    label15 = new JLabel();
    ldavg_1 = new JTextField();
    label19 = new JLabel();
    ldavg_5 = new JTextField();
    label20 = new JLabel();
    ldavg_15 = new JTextField();
    panel3 = new JPanel();
    progressBar = new JProgressBar();
    panelGraph = new JPanel();
    graphPanel = new JPanel();
    label23 = new JLabel();
    label38 = new JLabel();
    text_ClassRate = new JTextField();
    label24 = new JLabel();
    button_CostanteCodaSuMedia = new JButton();
    label39 = new JLabel();
    button_ClassRateCodaSuMedia = new JButton();
    label25 = new JLabel();
    button_CostanteTempoMedioArrivo = new JButton();
    hSpacer1 = new JPanel(null);
    label40 = new JLabel();
    button_ClassRateTempoMedioArrivo = new JButton();
    label26 = new JLabel();
    label41 = new JLabel();
    label27 = new JLabel();
    label42 = new JLabel();
    label28 = new JLabel();
    label33 = new JLabel();
    label29 = new JLabel();
    label30 = new JLabel();
    label31 = new JLabel();
    label32 = new JLabel();
    button_CrescenteCodaSuMedia = new JButton();
    label34 = new JLabel();
    button_BurstCodaSuMedia = new JButton();
    button_CrescenteCarico = new JButton();
    label35 = new JLabel();
    button_BurstTempoMedioArrivo = new JButton();
    label36 = new JLabel();
    label37 = new JLabel();
    label22 = new JLabel();
    title1 = compFactory.createTitle("HPSsim 2.0 ");
    button1 = new JButton();
    okButton = new JButton();
    button3 = new JButton();
    dialog1 = new JDialog();
    button2 = new JButton();
    label13 = new JLabel();
    erroreLabel = new JLabel();
    Grafici = new JFrame();
    panelGraficoFinestra = new JPanel();

    //======== HPSsimWindow ========
    {/*from  w  w  w .j a  v  a  2  s.c om*/
        HPSsimWindow.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        HPSsimWindow.setResizable(false);
        Container HPSsimWindowContentPane = HPSsimWindow.getContentPane();

        //======== hpssimWindow ========
        {
            hpssimWindow.setForeground(Color.blue);

            // JFormDesigner evaluation mark
            hpssimWindow.setBorder(new javax.swing.border.CompoundBorder(
                    new javax.swing.border.TitledBorder(new javax.swing.border.EmptyBorder(0, 0, 0, 0),
                            "JFormDesigner Evaluation", javax.swing.border.TitledBorder.CENTER,
                            javax.swing.border.TitledBorder.BOTTOM,
                            new java.awt.Font("Dialog", java.awt.Font.BOLD, 12), java.awt.Color.red),
                    hpssimWindow.getBorder()));
            hpssimWindow.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
                public void propertyChange(java.beans.PropertyChangeEvent e) {
                    if ("border".equals(e.getPropertyName()))
                        throw new RuntimeException();
                }
            });

            hpssimWindow.setLayout(null);

            //======== hpssimTab ========
            {

                //======== panelConfiguration ========
                {
                    panelConfiguration.setLayout(new TableLayout(
                            new double[][] { { 1, 70, 70, 70, 68, 70, 70, 74 }, { 0.01, 27, 21, 26, 27, 25, 25,
                                    25, 21, 21, TableLayout.PREFERRED, 12, TableLayout.PREFERRED, 22, 23 } }));
                    ((TableLayout) panelConfiguration.getLayout()).setHGap(5);
                    ((TableLayout) panelConfiguration.getLayout()).setVGap(5);

                    //---- label10 ----
                    label10.setText("Hardware");
                    label10.setFont(new Font("Segoe UI", Font.ITALIC, 16));
                    panelConfiguration.add(label10, new TableLayoutConstraints(1, 1, 7, 1,
                            TableLayoutConstraints.CENTER, TableLayoutConstraints.FULL));

                    //---- label3 ----
                    label3.setText("CPU");
                    label3.setFont(new Font("Segoe UI", Font.PLAIN, 12));
                    label3.setLabelFor(ncpu);
                    panelConfiguration.add(label3, new TableLayoutConstraints(1, 2, 1, 2,
                            TableLayoutConstraints.RIGHT, TableLayoutConstraints.FULL));

                    //---- ncpu ----
                    ncpu.setText("4");
                    panelConfiguration.add(ncpu, new TableLayoutConstraints(2, 2, 3, 2,
                            TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));

                    //---- label4 ----
                    label4.setText("GPU");
                    label4.setFont(new Font("Segoe UI", Font.PLAIN, 12));
                    label4.setLabelFor(ngpu);
                    panelConfiguration.add(label4, new TableLayoutConstraints(4, 2, 4, 2,
                            TableLayoutConstraints.RIGHT, TableLayoutConstraints.FULL));

                    //---- ngpu ----
                    ngpu.setText("0");
                    panelConfiguration.add(ngpu, new TableLayoutConstraints(5, 2, 6, 2,
                            TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));
                    panelConfiguration.add(vSpacer1, new TableLayoutConstraints(1, 3, 7, 3,
                            TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));

                    //---- label11 ----
                    label11.setText("Simulation");
                    label11.setFont(new Font("Segoe UI", Font.ITALIC, 16));
                    panelConfiguration.add(label11, new TableLayoutConstraints(1, 4, 7, 4,
                            TableLayoutConstraints.CENTER, TableLayoutConstraints.FULL));

                    //---- label2 ----
                    label2.setText("Sim Time");
                    panelConfiguration.add(label2, new TableLayoutConstraints(1, 5, 1, 5,
                            TableLayoutConstraints.RIGHT, TableLayoutConstraints.FULL));

                    //---- sliderSimulationTime ----
                    sliderSimulationTime.setValue(100000);
                    sliderSimulationTime.setMaximum(1200000);
                    sliderSimulationTime.addChangeListener(new ChangeListener() {
                        @Override
                        public void stateChanged(ChangeEvent e) {
                            sliderSimulationTimeStateChanged(e);
                        }
                    });
                    panelConfiguration.add(sliderSimulationTime, new TableLayoutConstraints(2, 5, 6, 5,
                            TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));

                    //---- textFieldSimTime ----
                    textFieldSimTime.setText("100000 ms");
                    panelConfiguration.add(textFieldSimTime, new TableLayoutConstraints(7, 5, 7, 5,
                            TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));

                    //---- label1 ----
                    label1.setText("Numero di job");
                    panelConfiguration.add(label1, new TableLayoutConstraints(1, 6, 1, 6,
                            TableLayoutConstraints.RIGHT, TableLayoutConstraints.CENTER));

                    //---- sliderJob ----
                    sliderJob.setMaximum(20000);
                    sliderJob.addChangeListener(new ChangeListener() {
                        @Override
                        public void stateChanged(ChangeEvent e) {
                            sliderJobStateChanged(e);
                        }
                    });
                    panelConfiguration.add(sliderJob, new TableLayoutConstraints(2, 6, 6, 6,
                            TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));

                    //---- textFieldNjob ----
                    textFieldNjob.setText("50");
                    panelConfiguration.add(textFieldNjob, new TableLayoutConstraints(7, 6, 7, 6,
                            TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));

                    //---- label9 ----
                    label9.setText("Media arrivo");
                    panelConfiguration.add(label9, new TableLayoutConstraints(1, 7, 1, 7,
                            TableLayoutConstraints.RIGHT, TableLayoutConstraints.FULL));

                    //---- textFieldQVGA ----
                    textFieldQVGA.setText("230");
                    panelConfiguration.add(textFieldQVGA, new TableLayoutConstraints(2, 7, 2, 7,
                            TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));

                    //---- label43 ----
                    label43.setText("Media exe");
                    panelConfiguration.add(label43, new TableLayoutConstraints(3, 7, 3, 7,
                            TableLayoutConstraints.RIGHT, TableLayoutConstraints.FULL));

                    //---- tex_mediaexe ----
                    tex_mediaexe.setText("1000");
                    panelConfiguration.add(tex_mediaexe, new TableLayoutConstraints(4, 7, 4, 7,
                            TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));

                    //---- checkBoxEndJob ----
                    checkBoxEndJob.setText("End Job");
                    panelConfiguration.add(checkBoxEndJob, new TableLayoutConstraints(6, 7, 6, 7,
                            TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));

                    //---- label6 ----
                    label6.setText("Scheduler");
                    panelConfiguration.add(label6, new TableLayoutConstraints(1, 9, 1, 9,
                            TableLayoutConstraints.RIGHT, TableLayoutConstraints.FULL));

                    //---- comboBoxScheduler ----
                    comboBoxScheduler.setModel(new DefaultComboBoxModel<>(
                            new String[] { "Priority Round Robin", "Completely Fair Scheduler" }));
                    comboBoxScheduler.addActionListener(new ActionListener() {
                        @Override
                        public void actionPerformed(ActionEvent e) {
                            comboBoxSchedulerActionPerformed(e);
                        }
                    });
                    panelConfiguration.add(comboBoxScheduler, new TableLayoutConstraints(2, 9, 5, 9,
                            TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));

                    //---- label8 ----
                    label8.setText("Time Slice");
                    panelConfiguration.add(label8, new TableLayoutConstraints(6, 9, 6, 9,
                            TableLayoutConstraints.RIGHT, TableLayoutConstraints.FULL));

                    //---- textFieldTimeSlice ----
                    textFieldTimeSlice.setText("210");
                    panelConfiguration.add(textFieldTimeSlice, new TableLayoutConstraints(7, 9, 7, 9,
                            TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));

                    //---- label7 ----
                    label7.setText("Queue");
                    panelConfiguration.add(label7, new TableLayoutConstraints(1, 10, 1, 10,
                            TableLayoutConstraints.RIGHT, TableLayoutConstraints.FULL));

                    //---- comboBoxQueue ----
                    comboBoxQueue.setModel(new DefaultComboBoxModel<>(new String[] { "FIFO",
                            "Highest Priority First", "Shortest Job First", "Round Robin", "Random Queue" }));
                    panelConfiguration.add(comboBoxQueue, new TableLayoutConstraints(2, 10, 5, 10,
                            TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));
                    panelConfiguration.add(vSpacer2, new TableLayoutConstraints(1, 11, 7, 11,
                            TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));

                    //---- label21 ----
                    label21.setText("Class Rate");
                    panelConfiguration.add(label21, new TableLayoutConstraints(1, 12, 1, 12,
                            TableLayoutConstraints.RIGHT, TableLayoutConstraints.FULL));

                    //---- sliderclassRate ----
                    sliderclassRate.setValue(99);
                    sliderclassRate.addChangeListener(new ChangeListener() {
                        @Override
                        public void stateChanged(ChangeEvent e) {
                            sliderclassRateStateChanged(e);
                        }
                    });
                    panelConfiguration.add(sliderclassRate, new TableLayoutConstraints(2, 12, 4, 12,
                            TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));

                    //---- labelclassRate ----
                    labelclassRate.setText("99%");
                    panelConfiguration.add(labelclassRate, new TableLayoutConstraints(5, 12, 5, 12,
                            TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));

                    //---- label12 ----
                    label12.setText("RT Job Prob");
                    panelConfiguration.add(label12, new TableLayoutConstraints(1, 13, 1, 13,
                            TableLayoutConstraints.RIGHT, TableLayoutConstraints.FULL));

                    //---- sliderRTJob ----
                    sliderRTJob.setValue(45);
                    sliderRTJob.addChangeListener(new ChangeListener() {
                        @Override
                        public void stateChanged(ChangeEvent e) {
                            sliderRTJobStateChanged(e);
                        }
                    });
                    panelConfiguration.add(sliderRTJob, new TableLayoutConstraints(2, 13, 4, 13,
                            TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));

                    //---- labelRT ----
                    labelRT.setText("45%");
                    panelConfiguration.add(labelRT, new TableLayoutConstraints(5, 13, 5, 13,
                            TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));

                    //---- label14 ----
                    label14.setText("OpenCL Job ");
                    panelConfiguration.add(label14, new TableLayoutConstraints(1, 14, 1, 14,
                            TableLayoutConstraints.RIGHT, TableLayoutConstraints.FULL));

                    //---- sliderOpenCl ----
                    sliderOpenCl.setValue(20);
                    sliderOpenCl.addChangeListener(new ChangeListener() {
                        @Override
                        public void stateChanged(ChangeEvent e) {
                            sliderOpenClStateChanged(e);
                        }
                    });
                    panelConfiguration.add(sliderOpenCl, new TableLayoutConstraints(2, 14, 4, 14,
                            TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));

                    //---- labelOPENCL ----
                    labelOPENCL.setText("20%");
                    panelConfiguration.add(labelOPENCL, new TableLayoutConstraints(5, 14, 5, 14,
                            TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));

                    //---- checkBox_enableLog ----
                    checkBox_enableLog.setText("log");
                    panelConfiguration.add(checkBox_enableLog, new TableLayoutConstraints(7, 14, 7, 14,
                            TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));
                }
                hpssimTab.addTab("Configuration", panelConfiguration);

                //======== panelPerformance ========
                {

                    //======== tabbedPane1 ========
                    {

                        //======== panelCPU ========
                        {
                            panelCPU.setLayout(new BorderLayout());

                            //---- labelCPUUsage ----
                            labelCPUUsage.setText("0\\0");
                            labelCPUUsage.setHorizontalAlignment(SwingConstants.CENTER);
                            panelCPU.add(labelCPUUsage, BorderLayout.SOUTH);
                        }
                        tabbedPane1.addTab("Usage", panelCPU);

                        //======== panelCPUQueue ========
                        {
                            panelCPUQueue.setLayout(new BorderLayout());
                        }
                        tabbedPane1.addTab("Queue", panelCPUQueue);

                    }

                    //======== tabbedPane2 ========
                    {

                        //======== panelGPU ========
                        {
                            panelGPU.setLayout(new BorderLayout());

                            //---- labelGPUUsage ----
                            labelGPUUsage.setText("0\\0");
                            labelGPUUsage.setHorizontalAlignment(SwingConstants.CENTER);
                            panelGPU.add(labelGPUUsage, BorderLayout.SOUTH);
                        }
                        tabbedPane2.addTab("Usage", panelGPU);

                        //======== panelGPUQueue ========
                        {
                            panelGPUQueue.setLayout(new BorderLayout());
                        }
                        tabbedPane2.addTab("Queue", panelGPUQueue);

                    }

                    //======== panel2 ========
                    {
                        panel2.setLayout(new TableLayout(new double[][] {
                                { TableLayout.PREFERRED, TableLayout.FILL },
                                { TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED,
                                        TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED,
                                        TableLayout.PREFERRED, TableLayout.PREFERRED } }));

                        //---- label18 ----
                        label18.setText("Virtual Time");
                        panel2.add(label18, new TableLayoutConstraints(0, 0, 0, 0, TableLayoutConstraints.RIGHT,
                                TableLayoutConstraints.FULL));
                        panel2.add(virtualTime, new TableLayoutConstraints(1, 0, 1, 0,
                                TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));

                        //---- label5 ----
                        label5.setText("Processi nel sistema");
                        panel2.add(label5, new TableLayoutConstraints(0, 2, 0, 2, TableLayoutConstraints.RIGHT,
                                TableLayoutConstraints.FULL));

                        //---- processiNelSistema ----
                        processiNelSistema.setText("0");
                        panel2.add(processiNelSistema, new TableLayoutConstraints(1, 2, 1, 2,
                                TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));

                        //---- label17 ----
                        label17.setText("Processi in elaborazione");
                        panel2.add(label17, new TableLayoutConstraints(0, 3, 0, 3, TableLayoutConstraints.RIGHT,
                                TableLayoutConstraints.FULL));

                        //---- processiElaborazione ----
                        processiElaborazione.setText("0");
                        panel2.add(processiElaborazione, new TableLayoutConstraints(1, 3, 1, 3,
                                TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));

                        //---- label16 ----
                        label16.setText("Processi in coda");
                        panel2.add(label16, new TableLayoutConstraints(0, 4, 0, 4, TableLayoutConstraints.RIGHT,
                                TableLayoutConstraints.FULL));

                        //---- processiInCoda ----
                        processiInCoda.setText("0");
                        panel2.add(processiInCoda, new TableLayoutConstraints(1, 4, 1, 4,
                                TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));

                        //---- label15 ----
                        label15.setText("ldavg_1");
                        panel2.add(label15, new TableLayoutConstraints(0, 5, 0, 5, TableLayoutConstraints.RIGHT,
                                TableLayoutConstraints.FULL));
                        panel2.add(ldavg_1, new TableLayoutConstraints(1, 5, 1, 5, TableLayoutConstraints.FULL,
                                TableLayoutConstraints.FULL));

                        //---- label19 ----
                        label19.setText("ldavg_5");
                        panel2.add(label19, new TableLayoutConstraints(0, 6, 0, 6, TableLayoutConstraints.RIGHT,
                                TableLayoutConstraints.FULL));
                        panel2.add(ldavg_5, new TableLayoutConstraints(1, 6, 1, 6, TableLayoutConstraints.FULL,
                                TableLayoutConstraints.FULL));

                        //---- label20 ----
                        label20.setText("ldavg_15");
                        panel2.add(label20, new TableLayoutConstraints(0, 7, 0, 7, TableLayoutConstraints.RIGHT,
                                TableLayoutConstraints.FULL));
                        panel2.add(ldavg_15, new TableLayoutConstraints(1, 7, 1, 7, TableLayoutConstraints.FULL,
                                TableLayoutConstraints.FULL));
                    }

                    //======== panel3 ========
                    {
                        panel3.setLayout(new TableLayout(new double[][] {
                                { TableLayout.PREFERRED, TableLayout.PREFERRED },
                                { TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED } }));
                    }

                    GroupLayout panelPerformanceLayout = new GroupLayout(panelPerformance);
                    panelPerformance.setLayout(panelPerformanceLayout);
                    panelPerformanceLayout.setHorizontalGroup(panelPerformanceLayout.createParallelGroup()
                            .addGroup(panelPerformanceLayout.createSequentialGroup().addContainerGap()
                                    .addGroup(panelPerformanceLayout.createParallelGroup()
                                            .addComponent(separator1)
                                            .addGroup(panelPerformanceLayout.createSequentialGroup()
                                                    .addGroup(panelPerformanceLayout.createParallelGroup()
                                                            .addGroup(panelPerformanceLayout
                                                                    .createSequentialGroup()
                                                                    .addComponent(panel2,
                                                                            GroupLayout.PREFERRED_SIZE, 256,
                                                                            GroupLayout.PREFERRED_SIZE)
                                                                    .addPreferredGap(
                                                                            LayoutStyle.ComponentPlacement.UNRELATED)
                                                                    .addGroup(panelPerformanceLayout
                                                                            .createParallelGroup()
                                                                            .addComponent(progressBar,
                                                                                    GroupLayout.DEFAULT_SIZE,
                                                                                    GroupLayout.DEFAULT_SIZE,
                                                                                    Short.MAX_VALUE)
                                                                            .addGroup(panelPerformanceLayout
                                                                                    .createSequentialGroup()
                                                                                    .addComponent(panel3,
                                                                                            GroupLayout.PREFERRED_SIZE,
                                                                                            256,
                                                                                            GroupLayout.PREFERRED_SIZE)
                                                                                    .addGap(0, 0,
                                                                                            Short.MAX_VALUE))))
                                                            .addGroup(panelPerformanceLayout
                                                                    .createSequentialGroup()
                                                                    .addComponent(tabbedPane1,
                                                                            GroupLayout.PREFERRED_SIZE, 261,
                                                                            GroupLayout.PREFERRED_SIZE)
                                                                    .addPreferredGap(
                                                                            LayoutStyle.ComponentPlacement.UNRELATED)
                                                                    .addComponent(tabbedPane2,
                                                                            GroupLayout.PREFERRED_SIZE, 261,
                                                                            GroupLayout.PREFERRED_SIZE)))
                                                    .addContainerGap(8, Short.MAX_VALUE)))));
                    panelPerformanceLayout.setVerticalGroup(panelPerformanceLayout.createParallelGroup()
                            .addGroup(panelPerformanceLayout.createSequentialGroup()
                                    .addContainerGap(15, Short.MAX_VALUE)
                                    .addGroup(panelPerformanceLayout.createParallelGroup()
                                            .addComponent(tabbedPane2, GroupLayout.DEFAULT_SIZE, 218,
                                                    GroupLayout.PREFERRED_SIZE)
                                            .addComponent(tabbedPane1, GroupLayout.PREFERRED_SIZE, 218,
                                                    GroupLayout.PREFERRED_SIZE))
                                    .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(separator1, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 10,
                                            Short.MAX_VALUE)
                                    .addGroup(panelPerformanceLayout
                                            .createParallelGroup(GroupLayout.Alignment.TRAILING, false)
                                            .addComponent(panel2, GroupLayout.PREFERRED_SIZE, 155,
                                                    GroupLayout.PREFERRED_SIZE)
                                            .addGroup(panelPerformanceLayout.createSequentialGroup()
                                                    .addComponent(progressBar, GroupLayout.DEFAULT_SIZE,
                                                            GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                    .addGap(18, 18, 18).addComponent(panel3,
                                                            GroupLayout.PREFERRED_SIZE, 119,
                                                            GroupLayout.PREFERRED_SIZE)))
                                    .addContainerGap()));
                }
                hpssimTab.addTab("Performance", panelPerformance);

                //======== panelGraph ========
                {

                    //======== graphPanel ========
                    {
                        graphPanel.setLayout(new TableLayout(new double[][] {
                                { TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED,
                                        TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED,
                                        TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED,
                                        TableLayout.PREFERRED },
                                { 27, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED,
                                        TableLayout.PREFERRED, 25, TableLayout.PREFERRED, TableLayout.PREFERRED,
                                        TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED,
                                        TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED,
                                        TableLayout.PREFERRED, TableLayout.PREFERRED } }));

                        //---- label23 ----
                        label23.setText("Carico costante");
                        label23.setFont(label23.getFont().deriveFont(Font.BOLD | Font.ITALIC));
                        graphPanel.add(label23, new TableLayoutConstraints(0, 0, 1, 0,
                                TableLayoutConstraints.CENTER, TableLayoutConstraints.FULL));

                        //---- label38 ----
                        label38.setText("Classification Rate");
                        label38.setFont(label38.getFont().deriveFont(Font.BOLD | Font.ITALIC));
                        graphPanel.add(label38, new TableLayoutConstraints(5, 0, 6, 0,
                                TableLayoutConstraints.CENTER, TableLayoutConstraints.FULL));
                        graphPanel.add(text_ClassRate, new TableLayoutConstraints(7, 0, 7, 0,
                                TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));

                        //---- label24 ----
                        label24.setText("Coda\\Media");
                        graphPanel.add(label24, new TableLayoutConstraints(0, 1, 0, 1,
                                TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));

                        //---- button_CostanteCodaSuMedia ----
                        button_CostanteCodaSuMedia.setText("Esegui");
                        button_CostanteCodaSuMedia.addActionListener(new ActionListener() {
                            @Override
                            public void actionPerformed(ActionEvent e) {
                                button_CostanteCodaSuMediaActionPerformed(e);
                            }
                        });
                        graphPanel.add(button_CostanteCodaSuMedia, new TableLayoutConstraints(2, 1, 2, 1,
                                TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));

                        //---- label39 ----
                        label39.setText("Coda\\Media");
                        graphPanel.add(label39, new TableLayoutConstraints(5, 1, 5, 1,
                                TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));

                        //---- button_ClassRateCodaSuMedia ----
                        button_ClassRateCodaSuMedia.setText("Esegui");
                        button_ClassRateCodaSuMedia.addActionListener(new ActionListener() {
                            @Override
                            public void actionPerformed(ActionEvent e) {
                                button_ClassRateCodaSuMediaActionPerformed(e);
                            }
                        });
                        graphPanel.add(button_ClassRateCodaSuMedia, new TableLayoutConstraints(7, 1, 7, 1,
                                TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));

                        //---- label25 ----
                        label25.setText("Tempo Medio Arrivo");
                        graphPanel.add(label25, new TableLayoutConstraints(0, 2, 0, 2,
                                TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));

                        //---- button_CostanteTempoMedioArrivo ----
                        button_CostanteTempoMedioArrivo.setText("Esegui");
                        button_CostanteTempoMedioArrivo.addActionListener(new ActionListener() {
                            @Override
                            public void actionPerformed(ActionEvent e) {
                                button_CostanteTempoMedioArrivoActionPerformed(e);
                            }
                        });
                        graphPanel.add(button_CostanteTempoMedioArrivo, new TableLayoutConstraints(2, 2, 2, 4,
                                TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));
                        graphPanel.add(hSpacer1, new TableLayoutConstraints(3, 0, 3, 15,
                                TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));

                        //---- label40 ----
                        label40.setText("Tempo Medio Arrivo");
                        graphPanel.add(label40, new TableLayoutConstraints(5, 2, 5, 2,
                                TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));

                        //---- button_ClassRateTempoMedioArrivo ----
                        button_ClassRateTempoMedioArrivo.setText("Esegui");
                        button_ClassRateTempoMedioArrivo.addActionListener(new ActionListener() {
                            @Override
                            public void actionPerformed(ActionEvent e) {
                                button_ClassRateTempoMedioArrivoActionPerformed(e);
                            }
                        });
                        graphPanel.add(button_ClassRateTempoMedioArrivo, new TableLayoutConstraints(7, 2, 7, 4,
                                TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));

                        //---- label26 ----
                        label26.setText("Troughput");
                        graphPanel.add(label26, new TableLayoutConstraints(0, 3, 0, 3,
                                TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));

                        //---- label41 ----
                        label41.setText("Troughput");
                        graphPanel.add(label41, new TableLayoutConstraints(5, 3, 5, 3,
                                TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));

                        //---- label27 ----
                        label27.setText("Carico");
                        graphPanel.add(label27, new TableLayoutConstraints(0, 4, 0, 4,
                                TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));

                        //---- label42 ----
                        label42.setText("Carico");
                        graphPanel.add(label42, new TableLayoutConstraints(5, 4, 5, 4,
                                TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));

                        //---- label28 ----
                        label28.setText("Carico Crescente");
                        label28.setFont(label28.getFont().deriveFont(Font.BOLD | Font.ITALIC));
                        graphPanel.add(label28, new TableLayoutConstraints(0, 5, 1, 5,
                                TableLayoutConstraints.CENTER, TableLayoutConstraints.FULL));

                        //---- label33 ----
                        label33.setText("Carico Burst");
                        label33.setFont(label33.getFont().deriveFont(Font.BOLD | Font.ITALIC));
                        graphPanel.add(label33, new TableLayoutConstraints(5, 5, 6, 5,
                                TableLayoutConstraints.CENTER, TableLayoutConstraints.FULL));

                        //---- label29 ----
                        label29.setText("Coda\\Media");
                        graphPanel.add(label29, new TableLayoutConstraints(0, 6, 0, 6,
                                TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));

                        //---- label30 ----
                        label30.setText("Tempo Medio Arrivo");
                        graphPanel.add(label30, new TableLayoutConstraints(0, 7, 0, 7,
                                TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));

                        //---- label31 ----
                        label31.setText("Troughput");
                        graphPanel.add(label31, new TableLayoutConstraints(0, 8, 0, 8,
                                TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));

                        //---- label32 ----
                        label32.setText("Carico");
                        graphPanel.add(label32, new TableLayoutConstraints(0, 9, 0, 9,
                                TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));

                        //---- button_CrescenteCodaSuMedia ----
                        button_CrescenteCodaSuMedia.setText("Esegui");
                        button_CrescenteCodaSuMedia.addActionListener(new ActionListener() {
                            @Override
                            public void actionPerformed(ActionEvent e) {
                                button_CrescenteCodaSuMediaActionPerformed(e);
                            }
                        });
                        graphPanel.add(button_CrescenteCodaSuMedia, new TableLayoutConstraints(2, 6, 2, 6,
                                TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));

                        //---- label34 ----
                        label34.setText("Coda\\Media");
                        graphPanel.add(label34, new TableLayoutConstraints(5, 6, 5, 6,
                                TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));

                        //---- button_BurstCodaSuMedia ----
                        button_BurstCodaSuMedia.setText("Esegui");
                        button_BurstCodaSuMedia.addActionListener(new ActionListener() {
                            @Override
                            public void actionPerformed(ActionEvent e) {
                                button_BurstCodaSuMediaActionPerformed(e);
                            }
                        });
                        graphPanel.add(button_BurstCodaSuMedia, new TableLayoutConstraints(7, 6, 7, 6,
                                TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));

                        //---- button_CrescenteCarico ----
                        button_CrescenteCarico.setText("Esegui");
                        button_CrescenteCarico.addActionListener(new ActionListener() {
                            @Override
                            public void actionPerformed(ActionEvent e) {
                                button_CrescenteCaricoActionPerformed(e);
                            }
                        });
                        graphPanel.add(button_CrescenteCarico, new TableLayoutConstraints(2, 7, 2, 9,
                                TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));

                        //---- label35 ----
                        label35.setText("Tempo Medio Arrivo");
                        graphPanel.add(label35, new TableLayoutConstraints(5, 7, 5, 7,
                                TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));

                        //---- button_BurstTempoMedioArrivo ----
                        button_BurstTempoMedioArrivo.setText("Esegui");
                        button_BurstTempoMedioArrivo.addActionListener(new ActionListener() {
                            @Override
                            public void actionPerformed(ActionEvent e) {
                                button_BurstTempoMedioArrivoActionPerformed(e);
                            }
                        });
                        graphPanel.add(button_BurstTempoMedioArrivo, new TableLayoutConstraints(7, 7, 7, 9,
                                TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));

                        //---- label36 ----
                        label36.setText("Troughput");
                        graphPanel.add(label36, new TableLayoutConstraints(5, 8, 5, 8,
                                TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));

                        //---- label37 ----
                        label37.setText("Carico");
                        graphPanel.add(label37, new TableLayoutConstraints(5, 9, 5, 9,
                                TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));
                    }

                    //---- label22 ----
                    label22.setText("Grafici");
                    label22.setFont(label22.getFont().deriveFont(label22.getFont().getStyle() | Font.BOLD,
                            label22.getFont().getSize() + 4f));

                    GroupLayout panelGraphLayout = new GroupLayout(panelGraph);
                    panelGraph.setLayout(panelGraphLayout);
                    panelGraphLayout.setHorizontalGroup(panelGraphLayout.createParallelGroup()
                            .addGroup(panelGraphLayout.createSequentialGroup().addGroup(panelGraphLayout
                                    .createParallelGroup()
                                    .addGroup(panelGraphLayout.createSequentialGroup().addGap(243, 243, 243)
                                            .addComponent(label22).addGap(0, 246, Short.MAX_VALUE))
                                    .addGroup(GroupLayout.Alignment.TRAILING,
                                            panelGraphLayout.createSequentialGroup().addContainerGap()
                                                    .addComponent(graphPanel, GroupLayout.DEFAULT_SIZE, 530,
                                                            Short.MAX_VALUE)))
                                    .addContainerGap()));
                    panelGraphLayout.setVerticalGroup(panelGraphLayout.createParallelGroup().addGroup(
                            GroupLayout.Alignment.TRAILING,
                            panelGraphLayout.createSequentialGroup().addContainerGap().addComponent(label22)
                                    .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(graphPanel, GroupLayout.DEFAULT_SIZE, 370, Short.MAX_VALUE)
                                    .addContainerGap()));
                }
                hpssimTab.addTab("Graph", panelGraph);

            }
            hpssimWindow.add(hpssimTab);
            hpssimTab.setBounds(10, 40, 555, 450);

            //---- title1 ----
            title1.setFont(title1.getFont().deriveFont(title1.getFont().getSize() + 8f));
            hpssimWindow.add(title1);
            title1.setBounds(10, 11, 132, title1.getPreferredSize().height);

            //---- button1 ----
            button1.setText("Stop");
            button1.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    button1ActionPerformed(e);
                }
            });
            hpssimWindow.add(button1);
            button1.setBounds(385, 495, 74, button1.getPreferredSize().height);

            //---- okButton ----
            okButton.setText("Start");
            okButton.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    okButtonActionPerformed(e);
                }
            });
            hpssimWindow.add(okButton);
            okButton.setBounds(470, 495, 74, okButton.getPreferredSize().height);

            //---- button3 ----
            button3.setText("Resume");
            button3.setVisible(false);
            button3.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    pauseActionPerformed(e);
                }
            });
            hpssimWindow.add(button3);
            button3.setBounds(300, 495, 74, button3.getPreferredSize().height);

            { // compute preferred size
                Dimension preferredSize = new Dimension();
                for (int i = 0; i < hpssimWindow.getComponentCount(); i++) {
                    Rectangle bounds = hpssimWindow.getComponent(i).getBounds();
                    preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
                    preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
                }
                Insets insets = hpssimWindow.getInsets();
                preferredSize.width += insets.right;
                preferredSize.height += insets.bottom;
                hpssimWindow.setMinimumSize(preferredSize);
                hpssimWindow.setPreferredSize(preferredSize);
            }
        }

        GroupLayout HPSsimWindowContentPaneLayout = new GroupLayout(HPSsimWindowContentPane);
        HPSsimWindowContentPane.setLayout(HPSsimWindowContentPaneLayout);
        HPSsimWindowContentPaneLayout.setHorizontalGroup(HPSsimWindowContentPaneLayout.createParallelGroup()
                .addGroup(HPSsimWindowContentPaneLayout.createSequentialGroup()
                        .addComponent(hpssimWindow, GroupLayout.PREFERRED_SIZE, 565, GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 4, Short.MAX_VALUE)));
        HPSsimWindowContentPaneLayout.setVerticalGroup(HPSsimWindowContentPaneLayout.createParallelGroup()
                .addGroup(HPSsimWindowContentPaneLayout.createSequentialGroup()
                        .addComponent(hpssimWindow, GroupLayout.PREFERRED_SIZE, 528, GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 1, Short.MAX_VALUE)));
        HPSsimWindow.pack();
        HPSsimWindow.setLocationRelativeTo(HPSsimWindow.getOwner());
    }

    //======== dialog1 ========
    {
        dialog1.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        Container dialog1ContentPane = dialog1.getContentPane();

        //---- button2 ----
        button2.setText("ok");
        button2.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                button2ActionPerformed(e);
            }
        });

        //---- label13 ----
        label13.setText("Attenzione!");

        GroupLayout dialog1ContentPaneLayout = new GroupLayout(dialog1ContentPane);
        dialog1ContentPane.setLayout(dialog1ContentPaneLayout);
        dialog1ContentPaneLayout.setHorizontalGroup(dialog1ContentPaneLayout.createParallelGroup()
                .addGroup(dialog1ContentPaneLayout.createSequentialGroup().addContainerGap()
                        .addGroup(dialog1ContentPaneLayout.createParallelGroup()
                                .addComponent(label13, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE,
                                        324, Short.MAX_VALUE)
                                .addGroup(GroupLayout.Alignment.TRAILING,
                                        dialog1ContentPaneLayout.createSequentialGroup()
                                                .addGap(0, 281, Short.MAX_VALUE).addComponent(button2))
                                .addComponent(erroreLabel, GroupLayout.DEFAULT_SIZE, 324, Short.MAX_VALUE))
                        .addContainerGap()));
        dialog1ContentPaneLayout.setVerticalGroup(dialog1ContentPaneLayout.createParallelGroup().addGroup(
                GroupLayout.Alignment.TRAILING,
                dialog1ContentPaneLayout.createSequentialGroup().addContainerGap()
                        .addComponent(label13, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 8, Short.MAX_VALUE)
                        .addComponent(erroreLabel, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(button2)
                        .addContainerGap()));
        dialog1.pack();
        dialog1.setLocationRelativeTo(dialog1.getOwner());
    }

    //======== Grafici ========
    {
        Container GraficiContentPane = Grafici.getContentPane();

        //======== panelGraficoFinestra ========
        {

            // JFormDesigner evaluation mark
            panelGraficoFinestra.setBorder(new javax.swing.border.CompoundBorder(
                    new javax.swing.border.TitledBorder(new javax.swing.border.EmptyBorder(0, 0, 0, 0),
                            "JFormDesigner Evaluation", javax.swing.border.TitledBorder.CENTER,
                            javax.swing.border.TitledBorder.BOTTOM,
                            new java.awt.Font("Dialog", java.awt.Font.BOLD, 12), java.awt.Color.red),
                    panelGraficoFinestra.getBorder()));
            panelGraficoFinestra.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
                public void propertyChange(java.beans.PropertyChangeEvent e) {
                    if ("border".equals(e.getPropertyName()))
                        throw new RuntimeException();
                }
            });

            panelGraficoFinestra.setLayout(new BorderLayout());
        }

        GroupLayout GraficiContentPaneLayout = new GroupLayout(GraficiContentPane);
        GraficiContentPane.setLayout(GraficiContentPaneLayout);
        GraficiContentPaneLayout.setHorizontalGroup(GraficiContentPaneLayout.createParallelGroup()
                .addGroup(GraficiContentPaneLayout.createSequentialGroup().addContainerGap()
                        .addComponent(panelGraficoFinestra, GroupLayout.DEFAULT_SIZE, 519, Short.MAX_VALUE)
                        .addContainerGap()));
        GraficiContentPaneLayout.setVerticalGroup(GraficiContentPaneLayout.createParallelGroup()
                .addGroup(GraficiContentPaneLayout.createSequentialGroup().addContainerGap()
                        .addComponent(panelGraficoFinestra, GroupLayout.DEFAULT_SIZE, 457, Short.MAX_VALUE)
                        .addContainerGap()));
        Grafici.pack();
        Grafici.setLocationRelativeTo(Grafici.getOwner());
    }
    // //GEN-END:initComponents
}

From source file:com.sciaps.view.SpectrumShotPanel.java

private void doBackgroundRemoval() {

    final int[] selectedRow = getSelectedRows();
    if (selectedRow == null || selectedRow.length == 0) {
        return;/*ww w .j a va2  s . c o  m*/
    }

    final double stepSize = baselineSettingPanel_.getStepSize();
    final double wlInterval = baselineSettingPanel_.getWaveLengthInterval();

    if (stepSize < 0 || wlInterval < 0) {
        return;
    }

    BackgroundTask.runBackgroundTask(new BackgroundTask() {

        private JDialog mDialog;
        private JProgressBar mProgress;

        @Override
        public void onBefore() {
            mProgress = new JProgressBar();
            mProgress.setIndeterminate(true);

            mDialog = new JDialog(Constants.MAIN_FRAME);
            mDialog.setLocationRelativeTo(Constants.MAIN_FRAME);
            mDialog.setAlwaysOnTop(true);
            mDialog.setResizable(false);
            mDialog.setContentPane(mProgress);
            mDialog.setSize(400, 100);
            mDialog.setVisible(true);
        }

        @Override
        public void onBackground() {

            final ArrayList<SpectrumShotItem> tmpList = new ArrayList<SpectrumShotItem>();
            final StringBuilder errMsg = new StringBuilder();

            for (int rowIndex = 0; rowIndex < selectedRow.length; rowIndex++) {
                String name = shotListTableModel_.getRow(selectedRow[rowIndex]).getName();
                name = name + "R" + stepSize + "_" + wlInterval;

                if (shotListTableModel_.isNameAlreadyExist(name) == false) {
                    Spectrum spectrum = shotListTableModel_.getRow(selectedRow[rowIndex]).getShot();

                    RawDataSpectrum rawSpect = doBackgroundRemoval(spectrum);

                    if (rawSpect != null) {
                        SpectrumShotItem shot = new SpectrumShotItem(name);
                        shot.setShot(rawSpect, SpectrumShotItem.BG_REMOVED);

                        tmpList.add(shot);
                    } else {
                        errMsg.append(name).append("\n");
                    }
                } else {
                    errMsg.append(name).append("\n");
                }
            }

            SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run() {
                    for (SpectrumShotItem shot : tmpList) {
                        shotListTableModel_.addRow(0, shot);
                    }

                    if (tmpList.isEmpty() == false) {
                        shotListTableModel_.showSeries(0);
                    }

                    if (errMsg.length() > 0) {
                        errMsg.insert(0, "The following shot(s) already exist, skipped:\n");
                        showErrorDialog(errMsg.toString());
                    }

                }
            });

        }

        @Override
        public void onAfter() {
            mDialog.setVisible(false);
        }
    });

}

From source file:br.com.jinsync.view.FrmJInSync.java

/**
 * Initialize the contents of the frame.
 *//* w w  w.  j ava 2  s.c  o  m*/
private void initialize() {

    Language.loadParameters();

    setBounds(100, 100, 1136, 665);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    GridBagLayout gridBagLayout = new GridBagLayout();
    gridBagLayout.columnWidths = new int[] { 0, 0 };
    gridBagLayout.rowHeights = new int[] { 600, 53, 0, 0 };
    gridBagLayout.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
    gridBagLayout.rowWeights = new double[] { 1.0, 0.0, 0.0, Double.MIN_VALUE };
    getContentPane().setLayout(gridBagLayout);

    grpFontes = new JTabbedPane(SwingConstants.TOP);
    GridBagConstraints gbc_grpFontes = new GridBagConstraints();
    gbc_grpFontes.insets = new Insets(0, 0, 5, 0);
    gbc_grpFontes.fill = GridBagConstraints.BOTH;
    gbc_grpFontes.gridx = 0;
    gbc_grpFontes.gridy = 0;
    getContentPane().add(grpFontes, gbc_grpFontes);

    tabCopybook = new JPanel();
    tabCopybook.setBackground(Color.WHITE);
    grpFontes.addTab(Language.tabCopy, null, tabCopybook, null);

    GridBagLayout gbl_tabCopybook = new GridBagLayout();
    gbl_tabCopybook.columnWidths = new int[] { 10, 1, 0, 349, 0, 0, 62, 28, 71, 0, 0, 0 };
    gbl_tabCopybook.rowHeights = new int[] { 1, 0, 0, 0 };
    gbl_tabCopybook.columnWeights = new double[] { 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0,
            Double.MIN_VALUE };
    gbl_tabCopybook.rowWeights = new double[] { 0.0, 0.0, 1.0, Double.MIN_VALUE };
    tabCopybook.setLayout(gbl_tabCopybook);

    JLabel lblCopybook = new JLabel(Language.txtFilePds);
    GridBagConstraints gbc_lblCopybook = new GridBagConstraints();
    gbc_lblCopybook.anchor = GridBagConstraints.EAST;
    gbc_lblCopybook.insets = new Insets(0, 0, 5, 5);
    gbc_lblCopybook.gridx = 1;
    gbc_lblCopybook.gridy = 1;
    tabCopybook.add(lblCopybook, gbc_lblCopybook);

    txtPath = new JTextField();
    GridBagConstraints gbc_txtPath = new GridBagConstraints();
    gbc_txtPath.gridwidth = 4;
    gbc_txtPath.insets = new Insets(0, 0, 5, 5);
    gbc_txtPath.fill = GridBagConstraints.HORIZONTAL;
    gbc_txtPath.gridx = 2;
    gbc_txtPath.gridy = 1;
    tabCopybook.add(txtPath, gbc_txtPath);
    txtPath.setColumns(10);

    JButton btnDiretorio = new JButton("");
    btnDiretorio.setIcon(new ImageIcon(FrmJInSync.class.getResource("/resources/folder.png")));
    btnDiretorio.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            openDirectory();
        }
    });
    GridBagConstraints gbc_btnDiretorio = new GridBagConstraints();
    gbc_btnDiretorio.insets = new Insets(0, 0, 5, 5);
    gbc_btnDiretorio.gridx = 6;
    gbc_btnDiretorio.gridy = 1;
    tabCopybook.add(btnDiretorio, gbc_btnDiretorio);

    btnClearCopy = new JButton("");
    btnClearCopy.setEnabled(false);
    btnClearCopy.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            tableCopy = new JTable();
            scrCopy.setViewportView(tableCopy);
            tableString = new JTable();
            scrTableString.setViewportView(tableString);

            btnExcelString.setEnabled(false);
            btnClearString.setEnabled(false);
            textAreaString.setText("");

            console.removeAllElements();
            btnExcel.setEnabled(false);
            btnClearCopy.setEnabled(false);
            grpFontes.setEnabledAt(1, false);

            tableFile = new JTable();
            scrFile.setViewportView(tableFile);
            btnExcelFile.setEnabled(false);
            btnClearFile.setEnabled(false);
            grpFontes.setEnabledAt(2, false);

        }
    });
    btnClearCopy.setIcon(new ImageIcon(FrmJInSync.class.getResource("/resources/cancel.png")));
    GridBagConstraints gbc_btnLimpar = new GridBagConstraints();
    gbc_btnLimpar.fill = GridBagConstraints.BOTH;
    gbc_btnLimpar.insets = new Insets(0, 0, 5, 5);
    gbc_btnLimpar.gridx = 9;
    gbc_btnLimpar.gridy = 1;
    tabCopybook.add(btnClearCopy, gbc_btnLimpar);

    JButton btnProcessarBook = new JButton("");
    btnProcessarBook.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            loadData();
            btnClearCopy.setEnabled(true);
            grpFontes.setEnabledAt(1, true);
            grpFontes.setEnabledAt(2, true);
        }
    });
    btnProcessarBook.setIcon(new ImageIcon(FrmJInSync.class.getResource("/resources/engine.png")));
    GridBagConstraints gbc_btnProcessarBook = new GridBagConstraints();
    gbc_btnProcessarBook.fill = GridBagConstraints.VERTICAL;
    gbc_btnProcessarBook.insets = new Insets(0, 0, 5, 5);
    gbc_btnProcessarBook.gridx = 7;
    gbc_btnProcessarBook.gridy = 1;
    tabCopybook.add(btnProcessarBook, gbc_btnProcessarBook);

    btnExcel = new JButton("");
    btnExcel.setEnabled(false);
    btnExcel.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            expExcelBook();
            // exportarExcelBook(tableCopy, txtPath.getText(),
            // "Horizontal");
        }
    });
    btnExcel.setIcon(new ImageIcon(FrmJInSync.class.getResource("/resources/excel.png")));
    GridBagConstraints gbc_btnExcel = new GridBagConstraints();
    gbc_btnExcel.insets = new Insets(0, 0, 5, 5);
    gbc_btnExcel.gridx = 8;
    gbc_btnExcel.gridy = 1;
    tabCopybook.add(btnExcel, gbc_btnExcel);

    // JScrollPane scrCopy = new JScrollPane();
    gbc_scrCopy = new GridBagConstraints();
    gbc_scrCopy.gridwidth = 9;
    gbc_scrCopy.insets = new Insets(0, 0, 0, 5);
    gbc_scrCopy.fill = GridBagConstraints.BOTH;
    gbc_scrCopy.gridx = 1;
    gbc_scrCopy.gridy = 2;
    // tabCopybook.add(scrCopy, gbc_scrCopy);

    panelConsole = new Panel();
    GridBagConstraints gbc_panelConsole = new GridBagConstraints();
    gbc_panelConsole.insets = new Insets(0, 0, 5, 0);
    gbc_panelConsole.fill = GridBagConstraints.BOTH;
    gbc_panelConsole.gridx = 0;
    gbc_panelConsole.gridy = 1;
    getContentPane().add(panelConsole, gbc_panelConsole);
    panelConsole.setLayout(new BorderLayout(0, 0));

    listTerminal = new JList<String>();
    listTerminal.setFont(new Font("Courier New", Font.PLAIN, 11));
    listTerminal.setModel(console);

    scrConsole = new JScrollPane(listTerminal);
    panelConsole.add(scrConsole);

    JMenuBar menuBar = new JMenuBar();
    setJMenuBar(menuBar);

    JMenu mnNewMenu = new JMenu(Language.menuParam);
    menuBar.add(mnNewMenu);

    JMenuItem mnItemUsuario = new JMenuItem(Language.menuParamUser);
    mnItemUsuario.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            FrmUser frmUsuar = new FrmUser();
            frmUsuar.setLocationRelativeTo(null);
            frmUsuar.setVisible(true);
            setUser();
        }
    });
    mnNewMenu.add(mnItemUsuario);

    JMenuItem mnItemFtp = new JMenuItem(Language.menuParamFtp);
    mnItemFtp.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            FrmFtp frmFtp = new FrmFtp();
            frmFtp.setLocationRelativeTo(null);
            frmFtp.setVisible(true);
            setFtp();
        }
    });

    mnNewMenu.add(mnItemFtp);

    JMenu mnAjuda = new JMenu(Language.menuHelp);
    menuBar.add(mnAjuda);

    JMenuItem mntmNewMenuItem = new JMenuItem(Language.menuHelpAbout);
    mntmNewMenuItem.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            FrmAbout frmSobre = new FrmAbout();
            frmSobre.setLocationRelativeTo(null);
            frmSobre.setVisible(true);
        }
    });
    mnAjuda.add(mntmNewMenuItem);

    tabCopybook.setFont(new Font("Arial", Font.PLAIN, 12));
    tabCopybook.add(scrCopy, gbc_scrCopy);

    tabString = new JPanel();
    tabString.setFont(new Font("Arial", Font.PLAIN, 12));
    tabString.setBackground(Color.WHITE);
    grpFontes.addTab(Language.tabString, null, tabString, null);
    grpFontes.setEnabledAt(1, false);
    GridBagLayout gbl_tabString = new GridBagLayout();
    gbl_tabString.columnWidths = new int[] { 10, 1, 346, 349, 0, 0, 62, 28, 71, 0, 0, 0 };
    gbl_tabString.rowHeights = new int[] { 1, 0, 0, 17, 22, 0, 259, 0 };
    gbl_tabString.columnWeights = new double[] { 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0,
            Double.MIN_VALUE };
    gbl_tabString.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, Double.MIN_VALUE };
    tabString.setLayout(gbl_tabString);

    JLabel lblString = new JLabel("String:");
    GridBagConstraints gbc_lblString = new GridBagConstraints();
    gbc_lblString.anchor = GridBagConstraints.WEST;
    gbc_lblString.insets = new Insets(0, 0, 5, 5);
    gbc_lblString.gridx = 1;
    gbc_lblString.gridy = 1;
    tabString.add(lblString, gbc_lblString);

    textAreaString = new JTextArea();

    JScrollPane scrStringData = new JScrollPane(textAreaString);
    GridBagConstraints gbc_scrString = new GridBagConstraints();
    gbc_scrString.gridheight = 3;
    gbc_scrString.gridwidth = 8;
    gbc_scrString.insets = new Insets(0, 0, 5, 5);
    gbc_scrString.fill = GridBagConstraints.BOTH;
    gbc_scrString.gridx = 1;
    gbc_scrString.gridy = 2;
    tabString.add(scrStringData, gbc_scrString);

    btnClearString = new JButton("");
    btnClearString.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            scrTableString.setViewportView(tableString);
            btnExcelString.setEnabled(false);
            btnClearString.setEnabled(false);
            textAreaString.setText("");
            tableString = new JTable();
            scrTableString.setViewportView(tableString);
        }
    });

    btnExcelString = new JButton("");
    btnExcelString.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            expExcelString();
        }
    });

    JButton btnProcessarArq = new JButton("");
    btnProcessarArq.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            processString();
        }
    });
    btnProcessarArq.setIcon(new ImageIcon(FrmJInSync.class.getResource("/resources/engine.png")));
    GridBagConstraints gbc_btnProcessarArq = new GridBagConstraints();
    gbc_btnProcessarArq.fill = GridBagConstraints.VERTICAL;
    gbc_btnProcessarArq.insets = new Insets(0, 0, 5, 5);
    gbc_btnProcessarArq.gridx = 9;
    gbc_btnProcessarArq.gridy = 2;
    tabString.add(btnProcessarArq, gbc_btnProcessarArq);
    btnExcelString.setIcon(new ImageIcon(FrmJInSync.class.getResource("/resources/excel.png")));
    btnExcelString.setEnabled(false);
    GridBagConstraints gbc_btnExcelString = new GridBagConstraints();
    gbc_btnExcelString.fill = GridBagConstraints.VERTICAL;
    gbc_btnExcelString.insets = new Insets(0, 0, 5, 5);
    gbc_btnExcelString.gridx = 9;
    gbc_btnExcelString.gridy = 3;
    tabString.add(btnExcelString, gbc_btnExcelString);
    btnClearString.setIcon(new ImageIcon(FrmJInSync.class.getResource("/resources/cancel.png")));
    btnClearString.setEnabled(false);
    GridBagConstraints gbc_btnClearString = new GridBagConstraints();
    gbc_btnClearString.fill = GridBagConstraints.VERTICAL;
    gbc_btnClearString.insets = new Insets(0, 0, 5, 5);
    gbc_btnClearString.gridx = 9;
    gbc_btnClearString.gridy = 4;
    tabString.add(btnClearString, gbc_btnClearString);

    JLabel lblSaida = new JLabel(Language.txtOutput);
    GridBagConstraints gbc_lblSaida = new GridBagConstraints();
    gbc_lblSaida.insets = new Insets(0, 0, 5, 5);
    gbc_lblSaida.gridx = 1;
    gbc_lblSaida.gridy = 5;
    tabString.add(lblSaida, gbc_lblSaida);

    GridBagConstraints gbc_scrArquivo = new GridBagConstraints();
    gbc_scrArquivo.fill = GridBagConstraints.BOTH;
    gbc_scrArquivo.gridwidth = 9;
    gbc_scrArquivo.insets = new Insets(0, 0, 0, 5);
    gbc_scrArquivo.gridx = 1;
    gbc_scrArquivo.gridy = 6;
    tabString.add(scrTableString, gbc_scrArquivo);

    tabFile = new JPanel();
    tabFile.addKeyListener(new KeyListener() {

        @Override
        public void keyPressed(KeyEvent e) {
            // TODO Auto-generated method stub
            if (isProcessStarted) {
                int key = e.getKeyCode();
                if (key == KeyEvent.VK_ESCAPE) {
                    int opc = JOptionPane.showConfirmDialog(null, Language.msgCancelProcess, Language.msgInf,
                            JOptionPane.OK_CANCEL_OPTION);
                    if (opc == JOptionPane.OK_OPTION) {
                        escProcessFile();
                    }
                }
            }

        }

        @Override
        public void keyReleased(KeyEvent arg0) {
            // TODO Auto-generated method stub

        }

        @Override
        public void keyTyped(KeyEvent arg0) {
            // TODO Auto-generated method stub

        }

    });

    tabFile.setFont(new Font("Arial", Font.PLAIN, 12));
    tabFile.setBackground(Color.WHITE);
    grpFontes.addTab(Language.tabFile, null, tabFile, null);
    grpFontes.setEnabledAt(2, false);
    GridBagLayout gbl_tabFile = new GridBagLayout();
    gbl_tabFile.columnWidths = new int[] { 10, 1, 49, 459, 0, 0, 62, 28, 0, 71, 0, 0, 0, 0 };
    gbl_tabFile.rowHeights = new int[] { 1, 0, 0, 17, 22, 0, 259, 0, 0 };
    gbl_tabFile.columnWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
            Double.MIN_VALUE };
    gbl_tabFile.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, Double.MIN_VALUE };
    tabFile.setLayout(gbl_tabFile);

    JLabel lblFile = new JLabel(Language.txtFilePds);
    GridBagConstraints gbc_lblFile = new GridBagConstraints();
    gbc_lblFile.anchor = GridBagConstraints.EAST;
    gbc_lblFile.insets = new Insets(0, 0, 5, 5);
    gbc_lblFile.gridx = 1;
    gbc_lblFile.gridy = 1;
    tabFile.add(lblFile, gbc_lblFile);

    txtFile = new JTextField();
    txtFile.setColumns(10);
    GridBagConstraints gbc_txtFile = new GridBagConstraints();
    gbc_txtFile.gridwidth = 5;
    gbc_txtFile.insets = new Insets(0, 0, 5, 5);
    gbc_txtFile.fill = GridBagConstraints.HORIZONTAL;
    gbc_txtFile.gridx = 2;
    gbc_txtFile.gridy = 1;
    tabFile.add(txtFile, gbc_txtFile);

    btnClearFile = new JButton("");
    btnClearFile.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {

            tableFile = new JTable();
            scrFile.setViewportView(tableFile);
            btnExcelFile.setEnabled(false);
            btnClearFile.setEnabled(false);
            progressBar.setStringPainted(true);
            progressBar.setValue(0);
            progressBar.setString("");

        }
    });

    btnExcelFile = new JButton("");
    btnExcelFile.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            expExcelFile();
        }
    });

    btnProcFile = new JButton("");
    btnProcFile.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            loadFile();
        }
    });

    btnDirFile = new JButton("");
    btnDirFile.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            openDirFile();
        }
    });
    btnDirFile.setIcon(new ImageIcon(FrmJInSync.class.getResource("/resources/folder.png")));
    GridBagConstraints gbc_btnDirFile = new GridBagConstraints();
    gbc_btnDirFile.fill = GridBagConstraints.VERTICAL;
    gbc_btnDirFile.insets = new Insets(0, 0, 5, 5);
    gbc_btnDirFile.gridx = 7;
    gbc_btnDirFile.gridy = 1;
    tabFile.add(btnDirFile, gbc_btnDirFile);
    btnProcFile.setIcon(new ImageIcon(FrmJInSync.class.getResource("/resources/engine.png")));
    GridBagConstraints gbc_btnProcFile = new GridBagConstraints();
    gbc_btnProcFile.fill = GridBagConstraints.VERTICAL;
    gbc_btnProcFile.insets = new Insets(0, 0, 5, 5);
    gbc_btnProcFile.gridx = 8;
    gbc_btnProcFile.gridy = 1;
    tabFile.add(btnProcFile, gbc_btnProcFile);
    btnExcelFile.setIcon(new ImageIcon(FrmJInSync.class.getResource("/resources/excel.png")));
    btnExcelFile.setEnabled(false);
    GridBagConstraints gbc_btnExcelFile = new GridBagConstraints();
    gbc_btnExcelFile.insets = new Insets(0, 0, 5, 5);
    gbc_btnExcelFile.gridx = 9;
    gbc_btnExcelFile.gridy = 1;
    tabFile.add(btnExcelFile, gbc_btnExcelFile);
    btnClearFile.setIcon(new ImageIcon(FrmJInSync.class.getResource("/resources/cancel.png")));
    btnClearFile.setEnabled(false);
    GridBagConstraints gbc_btnLimparFile = new GridBagConstraints();
    gbc_btnLimparFile.fill = GridBagConstraints.VERTICAL;
    gbc_btnLimparFile.insets = new Insets(0, 0, 5, 5);
    gbc_btnLimparFile.gridx = 10;
    gbc_btnLimparFile.gridy = 1;
    tabFile.add(btnClearFile, gbc_btnLimparFile);

    JLabel lblTamanho = new JLabel(Language.txtFileLength);
    GridBagConstraints gbc_lblTamanho = new GridBagConstraints();
    gbc_lblTamanho.anchor = GridBagConstraints.WEST;
    gbc_lblTamanho.insets = new Insets(0, 0, 5, 5);
    gbc_lblTamanho.gridx = 1;
    gbc_lblTamanho.gridy = 2;
    tabFile.add(lblTamanho, gbc_lblTamanho);

    txtLength = new JTextField();
    GridBagConstraints gbc_txtTamanho = new GridBagConstraints();
    gbc_txtTamanho.fill = GridBagConstraints.HORIZONTAL;
    gbc_txtTamanho.insets = new Insets(0, 0, 5, 5);
    gbc_txtTamanho.gridx = 2;
    gbc_txtTamanho.gridy = 2;
    tabFile.add(txtLength, gbc_txtTamanho);
    txtLength.setColumns(10);

    JLabel label_1 = new JLabel(Language.txtOutput);
    GridBagConstraints gbc_label_1 = new GridBagConstraints();
    gbc_label_1.anchor = GridBagConstraints.WEST;
    gbc_label_1.insets = new Insets(0, 0, 5, 5);
    gbc_label_1.gridx = 1;
    gbc_label_1.gridy = 3;
    tabFile.add(label_1, gbc_label_1);

    GridBagConstraints gbc_scrFile = new GridBagConstraints();
    gbc_scrFile.gridheight = 3;
    gbc_scrFile.fill = GridBagConstraints.BOTH;
    gbc_scrFile.gridwidth = 10;
    gbc_scrFile.insets = new Insets(0, 0, 5, 5);
    gbc_scrFile.gridx = 1;
    gbc_scrFile.gridy = 4;
    tabFile.add(scrFile, gbc_scrFile);

    progressBar = new JProgressBar();
    GridBagConstraints gbc_progressBar = new GridBagConstraints();
    gbc_progressBar.fill = GridBagConstraints.HORIZONTAL;
    gbc_progressBar.gridwidth = 10;
    gbc_progressBar.insets = new Insets(0, 0, 0, 5);
    gbc_progressBar.gridx = 1;
    gbc_progressBar.gridy = 7;
    tabFile.add(progressBar, gbc_progressBar);

    JLabel lblNewLabel = new JLabel(Language.txtDeveloped + " Rodrigo Augusto Silva dos Santos - 2016");
    GridBagConstraints gbc_lblNewLabel = new GridBagConstraints();
    gbc_lblNewLabel.gridx = 0;
    gbc_lblNewLabel.gridy = 2;
    getContentPane().add(lblNewLabel, gbc_lblNewLabel);

    loadParameters();

}

From source file:corelyzer.ui.CorelyzerApp.java

public JProgressBar getProgressUI() {
    if (usePluginUI) {
        JFrame f = getPluginFrame();

        if (f instanceof ProgressHandler) {
            ProgressHandler ph = (ProgressHandler) f;
            return (JProgressBar) ph.getProgressUI();
        }// w w w . j  a v a 2s. c o m
    }

    return new JProgressBar();
}