Example usage for java.awt Cursor getPredefinedCursor

List of usage examples for java.awt Cursor getPredefinedCursor

Introduction

In this page you can find the example usage for java.awt Cursor getPredefinedCursor.

Prototype

public static Cursor getPredefinedCursor(int type) 

Source Link

Document

Returns a cursor object with the specified predefined type.

Usage

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

/**
 * Initialises the interface of the simulation panel.
 *///ww  w.  ja  va  2s  .c o  m
protected void initialize() {
    setLayout(null);

    btnStart = new JButton("Start");
    btnStart.addActionListener(this);
    btnStart.setBounds(616, 326, 124, 23);
    btnStart.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    add(btnStart);

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

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

    lblOmsFile = new JLabel("Save OMS-File");
    lblOmsFile.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    lblOmsFile.setBounds(174, 272, 120, 14);
    add(lblOmsFile);

    txtOmsFile = new JTextField();
    txtOmsFile.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent arg0) {
            setOmsFile(txtOmsFile.getText());
        }
    });
    txtOmsFile.setBounds(304, 269, 302, 20);
    txtOmsFile.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    add(txtOmsFile);
    txtOmsFile.setColumns(10);

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

    lblWarning = new JLabel("This could take a while, grab a coffee!");
    lblWarning.setBounds(421, 94, 319, 15);
    lblWarning.setForeground(new Color(255, 0, 0, 255));
    lblWarning.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    add(lblWarning);

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

    lblSimulationType = new JLabel("Simulation Type");
    lblSimulationType.setBounds(10, 94, 132, 14);
    lblSimulationType.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    add(lblSimulationType);

    lblCampaigns = new JLabel("campaigns");
    lblCampaigns.setBounds(421, 122, 185, 14);
    lblCampaigns.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    add(lblCampaigns);

    lblRatio = new JLabel("Ratio");
    lblRatio.setBounds(174, 152, 44, 14);
    lblRatio.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    add(lblRatio);

    lblPercent = new JLabel("%");
    lblPercent.setBounds(246, 302, 360, 14);
    lblPercent.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    add(lblPercent);

    spnrRandomCampaigns = new JSpinner();
    spnrRandomCampaigns.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent e) {
            setRandomCampaigns((Integer) spnrRandomCampaigns.getValue());
        }
    });
    spnrRandomCampaigns.setModel(new SpinnerNumberModel(10000, 10, 100000, 1));
    spnrRandomCampaigns.setBounds(304, 119, 107, 22);
    spnrRandomCampaigns.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    add(spnrRandomCampaigns);

    spnrRatio3 = new JSpinner();
    spnrRatio3.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent e) {
            if (chckbxRatio3.isSelected()) {
                setRatio3((Integer) spnrRatio3.getValue());
            } else {
                setRatio3(0);
                spnrRatio3.setEnabled(false);
            }
        }
    });
    spnrRatio3.setModel(new SpinnerNumberModel(2, 0, 10000, 1));
    spnrRatio3.setBounds(330, 149, 81, 22);
    spnrRatio3.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    add(spnrRatio3);

    spnrRatio4 = new JSpinner();
    spnrRatio4.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent e) {
            if (chckbxRatio4.isSelected()) {
                setRatio4((Integer) spnrRatio4.getValue());
            } else {
                setRatio4(0);
                spnrRatio4.setEnabled(false);
            }
        }
    });
    spnrRatio4.setModel(new SpinnerNumberModel(5, 0, 10000, 1));
    spnrRatio4.setBounds(330, 179, 81, 22);
    spnrRatio4.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    add(spnrRatio4);

    spnrRatio5 = new JSpinner();
    spnrRatio5.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent e) {
            if (chckbxRatio5.isSelected()) {
                setRatio5((Integer) spnrRatio5.getValue());
            } else {
                setRatio5(0);
                spnrRatio5.setEnabled(false);
            }
        }
    });
    spnrRatio5.setModel(new SpinnerNumberModel(20, 0, 10000, 1));
    spnrRatio5.setBounds(330, 209, 81, 22);
    spnrRatio5.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    add(spnrRatio5);

    spnrRatio6 = new JSpinner();
    spnrRatio6.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent e) {
            if (chckbxRatio6.isSelected()) {
                setRatio6((Integer) spnrRatio6.getValue());
            } else {
                setRatio6(0);
                spnrRatio6.setEnabled(false);
            }
        }
    });
    spnrRatio6.setModel(new SpinnerNumberModel(73, 0, 10000, 1));
    spnrRatio6.setBounds(330, 239, 81, 22);
    spnrRatio6.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    add(spnrRatio6);

    spnrRandomNoise = new JSpinner();
    spnrRandomNoise.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent e) {
            if (chckbxRandomNoise.isSelected()) {
                setRandomNoise((Integer) spnrRandomNoise.getValue());
            } else {
                setRandomNoise(0);
                spnrRandomNoise.setEnabled(false);
            }
        }
    });
    spnrRandomNoise.setModel(new SpinnerNumberModel(5, 0, 20, 1));
    spnrRandomNoise.setBounds(153, 299, 83, 22);
    spnrRandomNoise.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    add(spnrRandomNoise);

    chckbxRatio3 = new JCheckBox("3 of 6");
    chckbxRatio3.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            if (chckbxRatio3.isSelected()) {
                if (rdbtnRandom.isSelected()) {
                    spnrRatio3.setEnabled(true);
                }
            } else {
                setRatio3(0);
                spnrRatio3.setEnabled(false);
            }
        }
    });
    chckbxRatio3.setBounds(237, 149, 80, 23);
    chckbxRatio3.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    add(chckbxRatio3);

    chckbxRatio4 = new JCheckBox("4 of 6");
    chckbxRatio4.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            if (chckbxRatio4.isSelected()) {
                if (rdbtnRandom.isSelected()) {
                    spnrRatio4.setEnabled(true);
                }
            } else {
                setRatio4(0);
                spnrRatio4.setEnabled(false);
            }
        }
    });
    chckbxRatio4.setBounds(237, 179, 80, 23);
    chckbxRatio4.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    add(chckbxRatio4);

    chckbxRatio5 = new JCheckBox("5 of 6");
    chckbxRatio5.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            if (chckbxRatio5.isSelected()) {
                if (rdbtnRandom.isSelected()) {
                    spnrRatio5.setEnabled(true);
                }
            } else {
                setRatio5(0);
                spnrRatio5.setEnabled(false);
            }
        }
    });
    chckbxRatio5.setBounds(237, 209, 80, 23);
    chckbxRatio5.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    add(chckbxRatio5);

    chckbxRatio6 = new JCheckBox("6 of 6");
    chckbxRatio6.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            if (chckbxRatio6.isSelected()) {
                if (rdbtnRandom.isSelected()) {
                    spnrRatio6.setEnabled(true);
                }
            } else {
                setRatio6(0);
                spnrRatio6.setEnabled(false);
            }
        }
    });
    chckbxRatio6.setBounds(237, 239, 80, 23);
    chckbxRatio6.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    add(chckbxRatio6);

    chckbxRandomNoise = new JCheckBox("Random noise");
    chckbxRandomNoise.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            if (chckbxRandomNoise.isSelected()) {
                if (chckbxRandomNoise.isEnabled()) {
                    spnrRandomNoise.setEnabled(true);
                }
            } else {
                setRandomNoise(0);
                spnrRandomNoise.setEnabled(false);
            }
        }
    });
    chckbxRandomNoise.setBounds(10, 299, 137, 23);
    chckbxRandomNoise.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    add(chckbxRandomNoise);

    btnRefresh = new JButton("Load");
    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);
                    comboBoxSelectProject.setEnabled(false);
                    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                    progressBarSimulation.setVisible(true);
                    progressBarSimulation.setStringPainted(true);
                    progressBarSimulation.setIndeterminate(true);
                    refreshTask = new Refresh();
                    refreshTask.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);
    btnRefresh.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    add(btnRefresh);

    lblHelp = new JLabel(
            "Select an OMB-Object file to run simulations. Limited random simulations can be saved as OMS-Simulation files used for analysis.");
    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);

    btnBrowseOmb = new JButton("Browse");
    btnBrowseOmb.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    btnBrowseOmb.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);
            }
        }
    });
    btnBrowseOmb.setBounds(616, 32, 124, 23);
    add(btnBrowseOmb);

    rdbtnSystematic = new JRadioButton("Systematic all campaigns");
    rdbtnSystematic.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent arg0) {
            if (rdbtnSystematic.isSelected()) {
                setSystematic(true);
                rdbtnRandom.setSelected(false);
                chckbxRatio6.setEnabled(false);
                chckbxRatio5.setEnabled(false);
                chckbxRatio4.setEnabled(false);
                chckbxRatio3.setEnabled(false);
                spnrRatio6.setEnabled(false);
                spnrRatio5.setEnabled(false);
                spnrRatio4.setEnabled(false);
                spnrRatio3.setEnabled(false);
                spnrRandomCampaigns.setEnabled(false);
                lblRatio.setEnabled(false);
                lblCampaigns.setEnabled(false);
                lblOmsFile.setEnabled(false);
                lblWarning.setVisible(true);
                txtOmsFile.setEnabled(false);
                btnBrowseOms.setEnabled(false);
            } else {
                setSystematic(false);
                rdbtnRandom.setSelected(true);
            }
        }
    });
    rdbtnSystematic.setBounds(152, 90, 259, 23);
    rdbtnSystematic.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    add(rdbtnSystematic);

    rdbtnRandom = new JRadioButton("Random");
    rdbtnRandom.setSelected(true);
    rdbtnRandom.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            if (rdbtnRandom.isSelected()) {
                setSystematic(false);
                rdbtnSystematic.setSelected(false);
                chckbxRatio6.setEnabled(true);
                chckbxRatio5.setEnabled(true);
                chckbxRatio4.setEnabled(true);
                chckbxRatio3.setEnabled(true);
                spnrRandomCampaigns.setEnabled(true);
                lblRatio.setEnabled(true);
                lblCampaigns.setEnabled(true);
                lblOmsFile.setEnabled(true);
                lblWarning.setVisible(false);
                txtOmsFile.setEnabled(true);
                btnBrowseOms.setEnabled(true);
            } else {
                setSystematic(true);
                rdbtnSystematic.setSelected(true);
            }
        }
    });
    rdbtnRandom.setBounds(152, 119, 142, 23);
    rdbtnRandom.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    add(rdbtnRandom);

    comboBoxSelectProject = new JComboBox<OMBuilding>();
    comboBoxSelectProject.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent arg0) {
            boolean b = false;
            if (comboBoxSelectProject.isEnabled()) {
                if (comboBoxSelectProject.getSelectedItem() != null) {
                    b = true;
                    setSelectedObject((OMBuilding) comboBoxSelectProject.getSelectedItem());
                    setProjectName(getSelectedObject().getName());
                } else {
                    b = false;
                }
            } else {
                b = false;
            }
            progressBarSimulation.setEnabled(b);
            btnStart.setEnabled(b);
            chckbxRandomNoise.setEnabled(b);
            rdbtnRandom.setEnabled(b);
            rdbtnSystematic.setEnabled(b);
            lblPercent.setEnabled(b);
            lblRatio.setEnabled(b);
            lblSimulationType.setEnabled(b);
            lblCampaigns.setEnabled(b);
        }
    });
    comboBoxSelectProject.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            boolean b = false;
            if (comboBoxSelectProject.isEnabled()) {
                if (comboBoxSelectProject.getSelectedItem() != null) {
                    b = true;
                    setSelectedObject((OMBuilding) comboBoxSelectProject.getSelectedItem());
                    setProjectName(getSelectedObject().getName());
                } else {
                    b = false;
                }
            } else {
                b = false;
            }
            progressBarSimulation.setEnabled(b);
            btnStart.setEnabled(b);
            chckbxRandomNoise.setEnabled(b);
            rdbtnRandom.setEnabled(b);
            rdbtnSystematic.setEnabled(b);
            lblPercent.setEnabled(b);
            lblRatio.setEnabled(b);
            lblSimulationType.setEnabled(b);
            lblCampaigns.setEnabled(b);
        }
    });
    comboBoxSelectProject.setBounds(152, 61, 454, 22);
    comboBoxSelectProject.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    add(comboBoxSelectProject);

    btnStart.setEnabled(false);
    chckbxRandomNoise.setEnabled(false);
    chckbxRatio6.setEnabled(false);
    chckbxRatio5.setEnabled(false);
    chckbxRatio4.setEnabled(false);
    chckbxRatio3.setEnabled(false);
    spnrRandomNoise.setEnabled(false);
    spnrRatio6.setEnabled(false);
    spnrRatio5.setEnabled(false);
    spnrRatio4.setEnabled(false);
    spnrRatio3.setEnabled(false);
    spnrRandomCampaigns.setEnabled(false);
    rdbtnRandom.setEnabled(false);
    rdbtnSystematic.setEnabled(false);
    lblPercent.setEnabled(false);
    lblRatio.setEnabled(false);
    lblSimulationType.setEnabled(false);
    lblCampaigns.setEnabled(false);
    lblOmsFile.setEnabled(false);
    txtOmsFile.setEnabled(false);
    btnBrowseOms.setEnabled(false);
    spnrRatio6.setValue(73);
    spnrRatio5.setValue(20);
    spnrRatio4.setValue(5);
    spnrRatio3.setValue(2);
    spnrRandomNoise.setValue(5);
    lblWarning.setVisible(false);
}

From source file:org.openmicroscopy.shoola.agents.treeviewer.view.TreeViewerComponent.java

/**
 * Implemented as specified by the {@link TreeViewer} interface.
 * @see TreeViewer#onNodesMoved()/*from w  ww  .  ja  v  a2  s .c  o m*/
 */
public void onNodesMoved() {
    if (model.getState() != SAVE)
        return;
    model.setState(READY);
    fireStateChange();
    view.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

    view.removeAllFromWorkingPane();
    DataBrowserFactory.discardAll();

    Browser browser = model.getSelectedBrowser();
    browser.refreshTree(null, null);
    model.getMetadataViewer().setRootObject(null, -1, null);
    setStatus(false, "", true);
    view.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}

From source file:lu.fisch.unimozer.Diagram.java

public void printDiagram() {
    // print preview takes a lot of memory (don't know why)
    // so it is a good idea to sugest to the JVM to clean up the heap
    System.gc();//w w w.j a  v a2 s . com
    printOptions = PrintOptions.showModal(frame, "Print options");
    if (printOptions.OK == true) {
        this.deselectAll();
        this.cleanAll();
        this.repaint();

        if (printOptions.getJob() == PrintOptions.JOB_PREVIEW) {
            PrintPreview pp = new PrintPreview(frame, this);
            pp.setLocation(Math.round((frame.getWidth() - pp.getWidth()) / 2 + frame.getLocation().x),
                    (frame.getHeight() - pp.getHeight()) / 2 + frame.getLocation().y);
            pp.setVisible(true);
        } else {
            try {
                // Use default printer, no dialog
                PrinterJob prnJob = PrinterJob.getPrinterJob();

                // get the default page format
                PageFormat pf0 = prnJob.defaultPage();
                // clone it
                PageFormat pf1 = (PageFormat) pf0.clone();
                Paper p = pf0.getPaper();
                // set to zero margin
                p.setImageableArea(0, 0, pf0.getWidth(), pf0.getHeight());
                pf1.setPaper(p);
                // let the printer validate it
                PageFormat pf2 = prnJob.validatePage(pf1);
                //prnJob.pageDialog(prnJob.defaultPage());

                prnJob.setPrintable(this, pf2);
                if (prnJob.printDialog()) {
                    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                    prnJob.print();
                    setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
                }
            } catch (PrinterException ex) {
                ex.printStackTrace();
                System.err.println("Printing error: " + ex.toString());
            }
        }
    }
    System.gc();
}

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

/**
 * An action event handler invoked when the user presses the start button.
 * Performs some validation checks on the input fields and starts the
 * simulation task. Displays warnings if malformed input is detected.
 * /*w ww  .  j a v a2s  .  c o m*/
 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
 */
@Override
public void actionPerformed(ActionEvent e) {
    setSelectedObject((OMBuilding) comboBoxSelectProject.getSelectedItem());
    setProjectName(getSelectedObject().getName());
    if (rdbtnSystematic.isSelected()) {
        setSystematic(true);
        setRandomCampaigns(0);
    } else {
        setSystematic(false);
        setRandomCampaigns((Integer) spnrRandomCampaigns.getValue());
    }
    if (chckbxRatio3.isSelected()) {
        setRatio3((Integer) spnrRatio3.getValue());
    } else {
        setRatio3(0);
    }
    if (chckbxRatio4.isSelected()) {
        setRatio4((Integer) spnrRatio4.getValue());
    } else {
        setRatio4(0);
    }
    if (chckbxRatio5.isSelected()) {
        setRatio5((Integer) spnrRatio5.getValue());
    } else {
        setRatio5(0);
    }
    if (chckbxRatio6.isSelected()) {
        setRatio6((Integer) spnrRatio6.getValue());
    } else {
        setRatio6(0);
    }
    if (chckbxRandomNoise.isSelected()) {
        setRandomNoise((Integer) spnrRandomNoise.getValue());
    } else {
        setRandomNoise(0);
    }

    if (isSystematic) {
        btnStart.setEnabled(false);
        comboBoxSelectProject.setEnabled(false);
        setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        progressBarSimulation.setStringPainted(true);
        progressBarSimulation.setIndeterminate(false);
        progressBarSimulation.setVisible(true);
        simulationTask = new Simulation();
        simulationTask.execute();
    } else {
        if (txtOmsFile.getText() != null && !txtOmsFile.getText().equals("")
                && !txtOmsFile.getText().equals(" ")) {
            txtOmsFile.setBackground(Color.WHITE);
            String omsPath = txtOmsFile.getText();
            String oms;
            String[] tmpFileName = omsPath.split("\\.");
            if (tmpFileName[tmpFileName.length - 1].equals("oms")) {
                oms = "";
            } else {
                oms = ".oms";
            }
            txtOmsFile.setText(omsPath + oms);
            setOmsFile(omsPath + oms);
            File omsFile = new File(omsPath + oms);
            if (!omsFile.exists()) {
                txtOmsFile.setBackground(Color.WHITE);
                btnStart.setEnabled(false);
                comboBoxSelectProject.setEnabled(false);
                setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                progressBarSimulation.setStringPainted(true);
                progressBarSimulation.setIndeterminate(false);
                progressBarSimulation.setVisible(true);
                simulationTask = new Simulation();
                simulationTask.execute();
            } else {
                txtOmsFile.setBackground(new Color(255, 222, 222, 128));
                JOptionPane.showMessageDialog(null, "This file already exists. Please select another OMS-file!",
                        "Error", JOptionPane.ERROR_MESSAGE);
            }
        } else {
            txtOmsFile.setBackground(new Color(255, 222, 222, 128));
            JOptionPane.showMessageDialog(null, "Please select an OMS-file!", "Warning",
                    JOptionPane.WARNING_MESSAGE);
        }
    }
}

From source file:UI.MainUI.java

private void forecastBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_forecastBtnActionPerformed
    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    DefaultTableModel dtm = (DefaultTableModel) forecastTable.getModel();
    dtm.setRowCount(0);//from   w  w w  .j av a2 s  . c  om
    dtm.setRowCount(4);

    if (algo == 1) {
        startFForecast();
    } else {
        startRForecast();
    }

    setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));

}

From source file:edu.harvard.mcz.imagecapture.SpecimenDetailsViewPane.java

/**
 * This method initializes jButton1   /*from   w  ww.j  a v  a 2s  .  c  o  m*/
 *    
 * @return javax.swing.JButton   
 */
private JButton getJButtonNext() {
    if (jButtonNext == null) {
        jButtonNext = new JButton();
        URL iconFile = this.getClass().getResource("/edu/harvard/mcz/imagecapture/resources/next.png");
        if (iconFile != null) {
            jButtonNext.setIcon(new ImageIcon(iconFile));
        } else {
            jButtonNext.setText("N");
        }
        jButtonNext.setMnemonic(KeyEvent.VK_N);
        jButtonNext.setEnabled(myControler.isInTable());
        jButtonNext.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent e) {
                try {
                    try {
                        thisPane.getParent().getParent()
                                .setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                    } catch (Exception ex) {
                        log.error(ex);
                    }
                    // try to move to the next specimen in the table.
                    if (thisPane.myControler.nextSpecimenInTable()) {
                        //thisPane.myControler.setSpecimen(thisPane.specimen.getSpecimenId() + 1);
                        thisPane.setVisible(false);
                        thisPane.myControler.displayInEditor();
                        thisPane.invalidate();
                    }
                    try {
                        thisPane.getParent().getParent()
                                .setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
                    } catch (Exception ex) {
                        log.error(ex);
                    }
                } catch (Exception e1) {
                    // TODO Auto-generated catch block
                    e1.printStackTrace();
                } finally {
                    try {
                        thisPane.getParent().getParent()
                                .setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
                    } catch (Exception ex) {
                        log.error(ex);
                    }
                }
            }
        });
    }
    return jButtonNext;
}

From source file:edu.harvard.mcz.imagecapture.SpecimenDetailsViewPane.java

/**
 * This method initializes jButton1   //from w  w  w  .j av a2  s.c  o m
 *    
 * @return javax.swing.JButton   
 */
private JButton getJButtonPrevious() {
    if (jButtonPrevious == null) {
        jButtonPrevious = new JButton();
        URL iconFile = this.getClass().getResource("/edu/harvard/mcz/imagecapture/resources/back.png");
        if (iconFile != null) {
            jButtonPrevious.setIcon(new ImageIcon(iconFile));
        } else {
            jButtonPrevious.setText("P");
        }
        jButtonPrevious.setMnemonic(KeyEvent.VK_P);
        jButtonPrevious.setToolTipText("Move to Previous Specimen");
        jButtonPrevious.setEnabled(myControler.isInTable());
        jButtonPrevious.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent e) {
                try {
                    try {
                        thisPane.getParent().getParent()
                                .setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                    } catch (Exception ex) {
                        log.error(ex);
                    }
                    // try to move to the previous specimen in the table.
                    if (thisPane.myControler.previousSpecimenInTable()) {
                        thisPane.setVisible(false);
                        thisPane.myControler.displayInEditor();
                        thisPane.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
                        thisPane.invalidate();
                    }
                    try {
                        thisPane.getParent().getParent()
                                .setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
                    } catch (Exception ex) {
                        log.error(ex);
                    }
                } catch (Exception e1) {
                    // TODO Auto-generated catch block
                    e1.printStackTrace();
                } finally {
                    try {
                        thisPane.getParent().getParent()
                                .setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
                        ;
                    } catch (Exception ex) {
                        log.error(ex);
                    }
                }
            }
        });
    }
    return jButtonPrevious;
}

From source file:UI.MainUI.java

private void submitBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_submitBtnActionPerformed
    // TODO add your handling code here:

    submitBtn.setEnabled(false);//from w ww  .j ava 2 s .  c  om
    finishBtn.setEnabled(false);
    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

    double minErrorCondition = 0.01;

    FFData data = new FFData();

    data.setCurrencyCol(fCurrencyComboBox.getSelectedIndex() + 1);
    data.setInputNeurons((Integer) inputNeurons.getValue());
    data.setHiddenNeurons((Integer) hiddenNeurons.getValue());
    data.setOutputNeurons((Integer) fOutputNeurons.getValue());
    data.setFilePath(filePath.getText());
    data.setEpoch((Integer) epochInput.getValue());
    data.setMinError(minErrorCondition);
    data.setContext(this);

    FFTrain task = new FFTrain(data);
    task.addPropertyChangeListener(new MyfnnListener());
    task.execute();

}

From source file:UI.MainUI.java

private void rSubmitBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rSubmitBtnActionPerformed
    rSubmitBtn.setEnabled(false);//from   w  ww .jav  a2  s  .c o m
    rFinishBtn.setEnabled(false);
    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

    double minErrorCondition = 0.01;

    RecurrentData data = new RecurrentData();

    data.setCurrencyCol(rCurrencyComboBox.getSelectedIndex() + 1);
    data.setInputNeurons((Integer) rInputNeurons.getValue());
    data.setHiddenNeurons1((Integer) rHiddenNeurons1.getValue());
    data.setHiddenNeurons2((Integer) rHiddenNeurons2.getValue());
    data.setOutputNeurons((Integer) rOutputNeurons.getValue());
    data.setFilePath(rFilePath.getText());
    data.setEpoch((Integer) rSpinner.getValue());
    data.setMinError(minErrorCondition);
    data.setContext(this);

    RecurrentTrain task = new RecurrentTrain(data);
    task.addPropertyChangeListener(new MyRnnListener());
    task.execute();
}

From source file:base.BasePlayer.Main.java

@Override
public void mousePressed(MouseEvent event) {
    //if(Logo.frame.isVisible()) {
    //   frame.requestFocus();
    //   }//from w w w.ja v a2 s .  com
    //   Logo.frame.setVisible(false);
    mouseX = event.getX();

    if (event.getSource() == refDropdown) {
        switch (event.getModifiers()) {
        case InputEvent.BUTTON1_MASK: {
            if (Main.genomehash.size() == 0) {
                if (AddGenome.frame == null) {
                    AddGenome.createAndShowGUI();
                }
                AddGenome.frame.setTitle("Add new genome");
                AddGenome.annotation = false;
                AddGenome.remove.setEnabled(false);
                AddGenome.download.setEnabled(false);
                AddGenome.frame.setVisible(true);
                AddGenome.frame.setLocation(
                        frame.getLocationOnScreen().x + frame.getWidth() / 2 - AddGenome.frame.getWidth() / 2,
                        frame.getLocationOnScreen().y + frame.getHeight() / 6);

                AddGenome.frame.setState(JFrame.NORMAL);
            }
            rightclick = false;
            break;
        }
        case InputEvent.BUTTON3_MASK: {
            rightclick = true;
            break;
        }
        }
    } else if (event.getSource() == geneDropdown) {
        switch (event.getModifiers()) {
        case InputEvent.BUTTON1_MASK: {
            if (Main.genomehash.size() == 0) {
                if (AddGenome.frame == null) {
                    AddGenome.createAndShowGUI();
                }
                AddGenome.frame.setTitle("Add new genome");
                AddGenome.annotation = false;
                AddGenome.remove.setEnabled(false);
                AddGenome.download.setEnabled(false);
                AddGenome.frame.setVisible(true);
                AddGenome.frame.setLocation(
                        frame.getLocationOnScreen().x + frame.getWidth() / 2 - AddGenome.frame.getWidth() / 2,
                        frame.getLocationOnScreen().y + frame.getHeight() / 6);

                AddGenome.frame.setState(JFrame.NORMAL);
            }
            rightclick = false;
            break;
        }
        case InputEvent.BUTTON3_MASK: {
            rightclick = true;
            break;
        }
        }
    } else if (event.getSource() == chromlabel) {
        chromosomeDropdown.showPopup();

    }

    else if (event.getSource() == splitPaneDivider) {
        Main.vardivider = bedCanvas.nodeImage.getHeight() / (double) varPaneDivider.getY();

        //      Main.bedCanvas.resize = true;
    } else if (event.getSource() == varPaneDivider) {
        //      Main.bedCanvas.resize = true;         
        Main.vardivider = bedCanvas.nodeImage.getHeight() / (double) varPaneDivider.getY();

    } else if (event.getSource() == filemenu) {
        /*if(!filemenu.isSelected()){            
           filemenu.doClick();         
        }
        */
    } else if (event.getSource() == toolmenu) {
        /*if(!toolmenu.isSelected()){            
           toolmenu.doClick();         
        }*/

    } else if (drawCanvas.loadingtext.equals("note")) {
        Main.drawCanvas.loadingtext = "";
        Main.drawCanvas.ready("note");

    }

    else if (event.getSource() == drawScroll.getVerticalScrollBar()) {

        if (Main.glassPane.getCursor().getType() != Cursor.WAIT_CURSOR) {
            Main.glassPane.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        }
        Draw.setGlasspane(true);

    } else if (event.getSource() == searchField) {
        searchField.requestFocus();
        searchField.setForeground(Color.black);
        if (searchField.getText().contains("Search by")) {
            searchField.setText("");
        }

    } else if (event.getSource() == addGenome) {
        if (AddGenome.frame == null) {
            AddGenome.createAndShowGUI();
        }
        AddGenome.frame.setTitle("Add new genome");
        AddGenome.annotation = false;
        AddGenome.remove.setEnabled(false);
        AddGenome.download.setEnabled(false);
        AddGenome.frame.setVisible(true);
        AddGenome.frame.setLocation(
                frame.getLocationOnScreen().x + frame.getWidth() / 2 - AddGenome.frame.getWidth() / 2,
                frame.getLocationOnScreen().y + frame.getHeight() / 6);
        AddGenome.frame.setState(JFrame.NORMAL);

    } else if (event.getComponent().getName() != null) {
        if (event.getComponent().getName().equals("frame0")) {
            return;
        }

        try {
            if (event.getComponent().getName().equals("add_annotation")) {
                if (AddGenome.frame == null) {
                    AddGenome.createAndShowGUI();
                }
                AddGenome.annotation = true;
                AddGenome.frame.setTitle("Add new annotation file for " + Main.selectedGenome);
                AddGenome.remove.setEnabled(false);
                AddGenome.download.setEnabled(false);
                AddGenome.frame.setVisible(true);
                AddGenome.frame.setLocation(
                        frame.getLocationOnScreen().x + frame.getWidth() / 2 - AddGenome.frame.getWidth() / 2,
                        frame.getLocationOnScreen().y + frame.getHeight() / 6);
                AddGenome.genomeName.setText(hoverGenome);
                return;
            }

            if (hoverAnnotation.length() > 0) {
                for (int j = 0; j < genomehash.get(hoverGenome).size(); j++) {
                    if (genomehash.get(hoverGenome).get(j).getName().contains(hoverAnnotation)) {
                        annotationfile = genomehash.get(hoverGenome).get(j).getName();
                        Main.annotation = j;
                        break;
                    }
                }

                defaultGenome = hoverGenome;

                setChromDrop(defaultGenome);
                getBands();
                if (genomehash.get(defaultGenome).size() > 0
                        && genomehash.get(defaultGenome).get(annotation) != null) {

                    changeAnnotation(annotation);

                }
                //drawCanvas.chrom = chromosomeDropdown.getItemAt(0);
                chromosomeDropdown.setSelectedIndex(0);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}