List of usage examples for java.awt Cursor WAIT_CURSOR
int WAIT_CURSOR
To view the source code for java.awt Cursor WAIT_CURSOR.
Click Source Link
From source file:v800_trainer.JCicloTronic.java
private void Graphik_PanelComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_Graphik_PanelComponentShown // Add your handling code here: setCursor(new Cursor(Cursor.WAIT_CURSOR)); if (SelectionChanged) { Statistik_PanelComponentShown_StatistikStarten(evt); Update_XYGraphik();/* ww w . j av a 2 s . co m*/ } if (Update_Graphik_paint == true) { Update_XYGraphik(); } Update_Map_paint = true; setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); }
From source file:de.main.sessioncreator.DesktopApplication1View.java
private void btnWizardNext(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnWizardNext int selTab = wizardtabp.getSelectedIndex(); int maxTab = wizardtabp.getTabCount(); try {/*from w w w. j a v a 2 s .c o m*/ wizardbtnBack.setEnabled(true); wizardbtntopBack.setEnabled(true); wizardtabp.setSelectedIndex(selTab + 1); if (wizardtabp.getTitleAt(wizardtabp.getSelectedIndex()).contains("Charter")) { wizardChckBxNewCharter.addActionListener(new chckBxNewCharterListener()); swingHelper.setTab1EnableAt(wizardtabp, 1); progressBar.setVisible(true); progressBar.setIndeterminate(true); wizardbtnBack.setEnabled(false); wizardbtntopBack.setEnabled(false); wizardbtnNext.setEnabled(false); wizardbtntopNext.setEnabled(false); mainPanel.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); wizardCmbxCharter.removeAllItems(); fileHelper.charterList.clear(); final File directory = new File(wizardTfPathTodo.getText()); worker = new SwingWorker<String, Void>() { @Override protected String doInBackground() { return getCharterBackgroundW(directory); } @Override protected void done() { try { if (!worker.get().contains("no")) { progressBar.setIndeterminate(false); progressBar.setVisible(false); wizardbtnBack.setEnabled(true); wizardbtntopBack.setEnabled(true); wizardbtnNext.setEnabled(true); wizardbtntopNext.setEnabled(true); int no = wizardCmbxCharter.getItemCount(); wizardLblChooseCharter.setText("Please select one of " + no + " Charter"); mainPanel.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } else { progressBar.setIndeterminate(false); progressBar.setVisible(false); wizardbtnBack.setEnabled(true); wizardbtntopBack.setEnabled(true); wizardbtnNext.setEnabled(false); wizardbtntopNext.setEnabled(false); mainPanel.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } catch (InterruptedException ex) { Logger.getLogger(DesktopApplication1View.class.getName()).log(Level.SEVERE, null, ex); } catch (ExecutionException ex) { Logger.getLogger(DesktopApplication1View.class.getName()).log(Level.SEVERE, null, ex); } } }; worker.execute(); } if (wizardtabp.getTitleAt(wizardtabp.getSelectedIndex()).contains("Areas")) { swingHelper.setTab1EnableAt(wizardtabp, 2); progressBar.setVisible(true); progressBar.setIndeterminate(true); wizardbtnBack.setEnabled(false); wizardbtntopBack.setEnabled(false); wizardbtnNext.setEnabled(false); wizardbtntopNext.setEnabled(false); wizardbtnAddAreas.setEnabled(false); if (wizardtaChoosenAreas.getDocument().getLength() == 0) { wizardbtnRemoveArea.setEnabled(false); } else { wizardbtnRemoveArea.setEnabled(true); } wizardtaChoosenAreas.getDocument().addDocumentListener(new choosenAreaListener()); wizardtabpAreas.removeAll(); final File coverageini = new File(wizardtfCoverageini.getText()); getAreasBacgroundW(coverageini); wizardbtnBack.setEnabled(true); wizardbtntopBack.setEnabled(true); wizardbtnNext.setEnabled(true); wizardbtntopNext.setEnabled(true); if (wizardChckBxNewCharter.isSelected()) { wizardbtnSaveTodo.setEnabled(true); } wizardbtnNext.setText("Create Testsession"); progressBar.setIndeterminate(false); progressBar.setVisible(false); if (!wizardChckBxNewCharter.isSelected()) { String todo = ChoosenCharter.substring(ChoosenCharter.indexOf("(" + wizardTfPathTodo.getText())) .replace("(", "").replace(")", ""); final File todocheckliste = new File(todo); String msg = "Import all Areas from the Todo-Session?"; fileHelper.getAreasChecklist(todocheckliste); fileHelper.areaChecklist.remove(0); if (!fileHelper.areaChecklist.get(0).isEmpty()) { if (JOptionPane.showConfirmDialog(wizardtabpAreas, msg, "Import?", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) == 0) { wizardtaChoosenAreas.setText(""); for (String s : fileHelper.areaChecklist) { wizardtaChoosenAreas.append(s + "\n"); } wizardtaChoosenAreas.setCaretPosition(0); } } } } if (wizardtabp.getTitleAt(wizardtabp.getSelectedIndex()).contains("Testsession")) { swingHelper.setTab1EnableAt(wizardtabp, 3); wizardbtnNext.setVisible(false); wizardbtntopNext.setEnabled(false); wizardbtnStart.addActionListener(new ButtonListenerStart()); wizardbtntopStart.addActionListener(new ButtonListenerStart()); wizardbtnStop.addActionListener(new ButtonListenerStop()); wizardbtntopStop.addActionListener(new ButtonListenerStop()); if (wizardChckBxNewCharter.isSelected()) { wizardtaCharterdynamic.setText(wizardtaNewCharter.getText().trim()); } else { wizardtaCharterdynamic.setText( ChoosenCharter.substring(0, ChoosenCharter.indexOf("(" + wizardTfPathTodo.getText()))); } statusMessageLabel.setText(""); wizardbtnStart.setVisible(true); wizardbtnStart.setEnabled(true); wizardbtntopStart.setEnabled(true); wizardbtnStop.setVisible(true); wizardbtnStop.setEnabled(false); wizardbtntopStop.setEnabled(false); final JPopupMenu popupMenu = new JPopupMenu(); final File coverageini = new File(wizardtfCoverageini.getText()); swingHelper.getAreastoPopupMenu(popupMenu, coverageini, new alBugsIssue()); popupListener2 = new PopupListener(popupMenu); wizardtaTestsessionAreas.addMouseListener(popupListener2); wizardtaTestsessionAreas.setText(wizardtaChoosenAreas.getText()); wizardtaTestsessionAreas.setCaretPosition(0); wizardtaCharterdynamic.setCaretPosition(0); if (wizardChckBxSecondTester.isSelected()) { TesterRealname = wizardCmbxTester.getSelectedItem().toString(); wizardtfNameOfTester.setText(TesterRealname.substring(4) + " " + wizardCmbxMoreTester.getSelectedItem().toString().substring(4)); } else { TesterRealname = wizardCmbxTester.getSelectedItem().toString(); wizardtfNameOfTester.setText(TesterRealname.substring(4)); } } if (wizardtabp.getSelectedIndex() == maxTab) { wizardbtnNext.setEnabled(false); wizardbtntopNext.setEnabled(false); } } catch (IndexOutOfBoundsException ex) { statusMessageLabel.setText(ex.getMessage()); } }
From source file:stainingestimation.StainingEstimation.java
/** * Opens a dialog to let the user choose a file in which the table of the staining estimation parameters is saved. *//*from ww w. jav a 2s . c om*/ private void saveTable() { if (previewOriginal != null && jXTable1.getRowCount() > 0) { String sep = manager.getColumnSeparator(); String currentDir = manager.getCurrentDir(); File file; List<String> exts = new ArrayList<>(1); exts.add("csv"); List<String> descrs = new ArrayList<>(1); descrs.add("Semicolon separated file"); String filename = null; if (manager.getVisibleTMAspot() != null) { filename = Misc.FilePathStringtoFilenameWOExtension(manager.getVisibleTMAspot().getName()) + ".csv"; } file = FileChooser.chooseSavingFile(this, currentDir, filename, exts, descrs); if (file != null) { setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); // Save csv try { BufferedWriter bfw = new BufferedWriter(new FileWriter(file)); for (int i = 0; i < jXTable1.getModel().getColumnCount(); i++) { bfw.write("\"" + jXTable1.getModel().getColumnName(i) + "\""); if (i < jXTable1.getModel().getColumnCount() - 1) bfw.write(sep); } for (int i = 0; i < jXTable1.getRowCount(); i++) { bfw.newLine(); for (int j = 0; j < jXTable1.getModel().getColumnCount(); j++) { Object o = jXTable1.getModel().getValueAt(i, j); if (((DefaultTableModel) jXTable1.getModel()).getColumnClass(j) == Double.class) { bfw.write((Double.toString((Double) jXTable1.getModel().getValueAt(i, j)))); } else if (((DefaultTableModel) jXTable1.getModel()) .getColumnClass(j) == Integer.class) { bfw.write((Integer.toString((Integer) jXTable1.getModel().getValueAt(i, j)))); } else if (((DefaultTableModel) jXTable1.getModel()) .getColumnClass(j) == String.class) { bfw.write("\"" + (String) (jXTable1.getModel().getValueAt(i, j)) + "\""); } else { bfw.write(jXTable1.getModel().getValueAt(i, j).toString()); } if (j < jXTable1.getModel().getColumnCount() - 1) bfw.write(sep); } } bfw.close(); } catch (Exception e) { Logger.getLogger(StainingEstimation.class.getName()).log(Level.SEVERE, null, e); JOptionPane.showMessageDialog(this, "Could not save file " + file.getName() + "\n(Maybe it is in use?)", "Error writing file", JOptionPane.ERROR_MESSAGE); } manager.setCurrentDir(file.getAbsolutePath()); setCursor(Cursor.getDefaultCursor()); } } }
From source file:com.monead.semantic.workbench.SemanticWorkbench.java
/** * Sets the mouse pointer. If the supplied parameter is true then the wait * cursor (usually an hourglass) is displayed. otherwise the system default * cursor is displayed./*from www.jav a 2 s.co m*/ * * @param wait * Whether to display the system default wait cursor */ private void setWaitCursor(boolean wait) { final JRootPane rootPane = getRootPane(); final Component glassPane = rootPane.getGlassPane(); if (wait) { final Cursor cursorWait = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR); rootPane.setCursor(cursorWait); glassPane.setCursor(cursorWait); glassPane.setVisible(true); } else { final Cursor cursorDefault = Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR); glassPane.setVisible(false); glassPane.setCursor(cursorDefault); rootPane.setCursor(cursorDefault); } glassPane.invalidate(); rootPane.validate(); }
From source file:de.bfs.radon.omsimulation.gui.OMPanelSimulation.java
/** * Initialises the interface of the simulation panel. *///from w w w . ja v a2 s. co 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:v800_trainer.JCicloTronic.java
private void Statistik_PanelComponentShown_StatistikStarten(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_Statistik_PanelComponentShown_StatistikStarten setCursor(new Cursor(Cursor.WAIT_CURSOR)); if (SelectionChanged) { clearStatistik();/*from w ww . j a v a2s. c o m*/ alteAuswahl = -5; Statistikhandle = new JStatistik(); Statistikhandle.StatistikStart(this);// Update_Graphik_paint = true; xygraphik = null; graph_min = 0; graph_max = 999999999; graph_crosshair = 0; nozoom = true; Update_Map_paint = true; } if (Datentabelle.getSelectedRowCount() != 0) { if (Statistikhandle != null) { Statistikhandle.TourData[0].createSubStatistik(this, graph_min, graph_max); } setStatistik(Statistikhandle, Auswahl_Statistik.getSelectedIndex()); } else { clearStatistik(); } setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); }
From source file:v800_trainer.JCicloTronic.java
public void ChangeModel() { setCursor(new Cursor(Cursor.WAIT_CURSOR)); if (Hauptfenster != null) Hauptfenster.setSelectedIndex(0); DataProperty = new java.util.Properties(); jTableaccess = Datentabelle;// w ww . j a v a 2 s. com String Filename = ""; String PlaceHolder = " "; File path = new File(Properties.getProperty("data.dir")); final String[] names = { "Datum", "Strecke", "Hhenmeter", "Zeit", "Titel" }; String[] list = path.list(new DirFilter("_Tour.cfg")); RowCount = 0; int Anzahlcfg = 0; if (list != null) Anzahlcfg = list.length; if (Anzahlcfg == 0) { setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); return; } Object datab[] = new Object[8]; ArrayList<Object[]> data_list = new ArrayList<Object[]>(); String hmString = ""; DecimalFormat form = new DecimalFormat("0");//Format ohne Kommastelle int j = 0; for (int i = 0; i < Anzahlcfg; i++) { //berprfen ob Hhenmeter eingetragen sind - ansonsten ermitteln (gilt fr neue Dateien) Filename = path.getPath() + SystemProperties.getProperty("file.separator") + list[i]; DataProperty = new java.util.Properties(); try { BufferedInputStream in = new BufferedInputStream(new FileInputStream(Filename)); DataProperty.load(in); in.close(); // prfen ob Datei gezeigt werden soll - Visible = 0 wenn Datei gelscht wurde if (!DataProperty.getProperty("Visible", "1").equalsIgnoreCase("1")) continue; // wenn keine Hhenmeter eingetragen wurden (Erstaufruf) dann Hhenmeter ermitteln if (DataProperty.getProperty("Hoehenmeter", "novalue").equalsIgnoreCase("novalue") && DataProperty.getProperty("Visible", "1").equalsIgnoreCase("1") && !DataProperty.getProperty("Jahr", "keinEintrag").equalsIgnoreCase("keinEintrag")) { JTourData Dummydata = new JTourData(Filename.substring(0, Filename.lastIndexOf('.')), this); DataProperty.setProperty("Hoehenmeter", form.format(Dummydata.ges_Hoehep)); try { Ausgabedatei = new FileOutputStream(Filename); DataProperty.store(Ausgabedatei, "Tour Eigenschaften: " + DataProperty.getProperty("Jahr") + DataProperty.getProperty("Monat") + DataProperty.getProperty("Tag") + DataProperty.getProperty("Stunde") + DataProperty.getProperty("Minute")); Ausgabedatei.close(); } catch (Exception e) { JOptionPane.showMessageDialog(null, " Fehler bei Speichern der DataProperty in ChangeModel", "Achtung!", JOptionPane.ERROR_MESSAGE); } } try { if (Integer.parseInt(DataProperty.getProperty("Visible", "1")) == 1 && !DataProperty.getProperty("Jahr", "keinEintrag").equalsIgnoreCase("keinEintrag")) { datab[0] = new String(" " + DataProperty.getProperty("Tag", "11") + "." + DataProperty.getProperty("Monat", "11") + "." + DataProperty.getProperty("Jahr", "1111")); datab[1] = PlaceHolder.substring(0, 9 - DataProperty.getProperty("Strecke", "0").length()) + DataProperty.getProperty("Strecke", "0") + " "; // data[j][1] = new String(DataProperty.getProperty("Strecke") + " "); datab[2] = new String( " " + HMS(java.lang.Integer.parseInt(DataProperty.getProperty("Dauer", "0")))); datab[3] = new String(DataProperty.getProperty("Titel", "---")); datab[4] = new String(DataProperty.getProperty("Jahr", "1111") + "." + DataProperty.getProperty("Monat", "11") + "." + DataProperty.getProperty("Tag", "11") + "." + DataProperty.getProperty("Stunde", "12") + "." + DataProperty.getProperty("Minute", "59")); datab[5] = new String(Filename.substring(0, Filename.lastIndexOf('.'))); datab[6] = new String(DataProperty.getProperty("Typ", "unbekannt")); hmString = "" + (int) Float.parseFloat(DataProperty.getProperty("Hoehenmeter", "0")); datab[7] = PlaceHolder.substring(0, 9 - hmString.length()) + hmString + " "; data_list.add(datab.clone()); } } catch (Exception e) { JOptionPane.showMessageDialog(null, "Fehler beim Erstellen der Datenliste " + e + " " + j, "Achtung!", JOptionPane.ERROR_MESSAGE); } } catch (Exception e) { System.out.println( "NEW IO-Fehler bei " + path.getPath() + SystemProperties.getProperty("file.separator") + list[i] + "\n " + e + " " + e.getLocalizedMessage() + "--File deleted"); e.printStackTrace(); JOptionPane.showMessageDialog(null, "Fehler beim Einlesen eines cfg Files " + path.getPath() + SystemProperties.getProperty("file.separator") + list[i] + "\n wurde gelscht!", "Achtung!", JOptionPane.ERROR_MESSAGE); File deletefile = new File( path.getPath() + SystemProperties.getProperty("file.separator") + list[i]); if (deletefile.exists()) deletefile.delete(); ChangeModel(); } } TableModel dataModel = new AbstractTableModel() { public int getColumnCount() { return names.length; } @Override public String getColumnName(int column) { return names[column]; } @Override public int getRowCount() { return data_list.size(); } @Override public Object getValueAt(int row, int col) { Object data[] = new Object[8]; data = data_list.get(row); return data[col]; } @Override public void setValueAt(Object Ob, int row, int col) { Object data[] = new Object[8]; data = data_list.get(row); data[col] = Ob; data_list.set(row, data); } }; sorter = new TableSorter(dataModel); DatumColumn = new TableColumn(0); DatumColumn.setHeaderValue(names[0]); DatumColumn.setResizable(false); StreckeColumn = new TableColumn(1); StreckeColumn.setHeaderValue(names[1]); StreckeColumn.setResizable(false); HoeheColumn = new TableColumn(7); HoeheColumn.setHeaderValue(names[2]); HoeheColumn.setResizable(false); ZeitColumn = new TableColumn(2); ZeitColumn.setHeaderValue(names[3]); ZeitColumn.setResizable(false); NotizColumn = new TableColumn(3); NotizColumn.setHeaderValue(names[4]); DatumColumn.setMinWidth((int) 80 * FontSize / 12); StreckeColumn.setMinWidth((int) 65 * FontSize / 12); HoeheColumn.setMinWidth((int) 75 * FontSize / 12); ZeitColumn.setMinWidth((int) 75 * FontSize / 12); NotizColumn.setMinWidth((int) 75 * FontSize / 12); NotizColumn.setPreferredWidth((int) 75 * FontSize / 12 + 1000); DefaultTableCellRenderer TableCell = new DefaultTableCellRenderer(); TableCell.setHorizontalAlignment(JLabel.CENTER); HoeheColumn.setCellRenderer(TableCell); StreckeColumn.setCellRenderer(TableCell); DatumColumn.setCellRenderer(TableCell); ZeitColumn.setCellRenderer(TableCell); HoeheColumn.setHeaderRenderer(TableCell); StreckeColumn.setHeaderRenderer(TableCell); DatumColumn.setHeaderRenderer(TableCell); ZeitColumn.setHeaderRenderer(TableCell); NotizColumn.setHeaderRenderer(TableCell); DefaultTableColumnModel FileTableModel = new DefaultTableColumnModel(); FileTableModel.addColumn(DatumColumn); FileTableModel.addColumn(StreckeColumn); FileTableModel.addColumn(HoeheColumn); FileTableModel.addColumn(ZeitColumn); FileTableModel.addColumn(NotizColumn); Datentabelle.setModel(sorter); Datentabelle.setColumnModel(FileTableModel); Datentabelle.setRowHeight(FontSize + 5); sorter.addMouseListenerToHeaderInTable(Datentabelle); sorter.sortByColumn(0, false); Datentabelle.clearSelection(); SelectionChanged = true; JScrollBar verticaldummy = Datenliste_scroll_Panel.getVerticalScrollBar(); verticaldummy.setPreferredSize(new Dimension(FontSize + 10, FontSize + 10)); Datenliste_scroll_Panel.setVerticalScrollBar(verticaldummy); Update = false; Datenliste_Jahr.removeAllItems(); Datenliste_TourTyp.removeAllItems(); Auswahl_bersicht.removeAllItems(); JahrVergleich.removeAllItems(); InitComboJahr(); InitComboTyp(); Update = true; if (Datentabelle.getRowCount() != 0) { Datentabelle.addRowSelectionInterval(0, 0); Datenliste_scroll_Panel.getViewport().setViewPosition(new java.awt.Point(0, 0)); } if (Uebersicht != null) { Uebersicht = null; } jLabel69_Selektiert.setText(Datentabelle.getSelectedRowCount() + " / " + Datentabelle.getRowCount()); repaint(); setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); }
From source file:org.openmicroscopy.shoola.agents.treeviewer.view.TreeViewerComponent.java
/** * Implemented as specified by the {@link TreeViewer} interface. * @see TreeViewer#onNodesMoved()//from w w w .ja v a2 s.c om */ 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 ww . ja v a 2 s .co m*/ 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. * //from ww w. j a v a2s. c om * @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); } } }