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:com.mirth.connect.manager.ManagerController.java
public void restartMirthWorker() { PlatformUI.MANAGER_DIALOG.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); setEnabledOptions(false, false, false, false); SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() { private String errorMessage = null; public Void doInBackground() { errorMessage = restartMirth(); return null; }/* w w w . j a va2 s . co m*/ public void done() { if (errorMessage == null) { PlatformUI.MANAGER_TRAY.alertInfo("The Mirth Connect Service was restarted successfully."); } else { PlatformUI.MANAGER_TRAY.alertError(errorMessage); } updateMirthServiceStatus(); PlatformUI.MANAGER_DIALOG.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }; worker.execute(); }
From source file:biz.wolschon.finance.jgnucash.panels.TaxReportPanel.java
/** * Show a dialog to export/* ww w . ja v a2s .co m*/ * a CSV-file that contains the * shown {@link TransactionSum}s * for each month, year or day. */ protected void showExportCSVDialog() { JFileChooser fc = new JFileChooser(); fc.setAcceptAllFileFilterUsed(true); fc.addChoosableFileFilter(new FileFilter() { @Override public boolean accept(final File aF) { return aF.isDirectory() || aF.getName().endsWith(".csv"); } @Override public String getDescription() { return "CSV-file"; } }); int dialogResult = fc.showSaveDialog(this); if (dialogResult != JFileChooser.APPROVE_OPTION) { return; } File file = fc.getSelectedFile(); if (file.exists()) { int confirmation = JOptionPane.showConfirmDialog(this, "File exists. Replace file?"); if (confirmation != JOptionPane.YES_OPTION) { showExportCSVDialog(); return; } } ExportGranularities gran = (ExportGranularities) myExportGranularityCombobox.getSelectedItem(); try { setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); exportCSV(file, gran); } finally { setCursor(Cursor.getDefaultCursor()); } }
From source file:de.juwimm.cms.gui.admin.PanUnitGroupPerUser.java
public void save() { setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); setPickerEnabled(false);// w w w .jav a 2 s .com btnSave.setEnabled(false); if (currentSelected >= 0) saveChanges(currentSelected); setPickerEnabled(true); btnSave.setEnabled(true); setCursor(Cursor.getDefaultCursor()); }
From source file:plugin.notes.gui.NotesView.java
/** * {@literal handle File->Open.} Will open any .gmn files, and import them into your * notes structure//from w w w .ja v a 2s. c o m */ public void handleOpen() { // TODO fix String sFile = SettingsHandler.getGMGenOption(OPTION_NAME_LASTFILE, System.getProperty("user.dir")); File defaultFile = new File(sFile); JFileChooser chooser = new JFileChooser(); chooser.setCurrentDirectory(defaultFile); chooser.addChoosableFileFilter(getFileType()); chooser.setFileFilter(getFileType()); chooser.setMultiSelectionEnabled(true); Component component = GMGenSystem.inst; Cursor originalCursor = component.getCursor(); component.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); int option = chooser.showOpenDialog(GMGenSystem.inst); if (option == JFileChooser.APPROVE_OPTION) { for (File noteFile : chooser.getSelectedFiles()) { SettingsHandler.setGMGenOption(OPTION_NAME_LASTFILE, noteFile.toString()); if (noteFile.toString().endsWith(EXTENSION)) { openGMN(noteFile); } } } GMGenSystem.inst.setCursor(originalCursor); refreshTree(); }
From source file:au.com.jwatmuff.eventmanager.gui.wizard.SeedingPanel.java
@Override public boolean nextButtonPressed() { if (!GUIUtils.confirmLock(null, "all players and fights in division " + pool.getDescription())) return false; // TODO: I would like this to be wrapped in a transaction, so that it can't fail halfway (e.g. players // locked, but fights not), but I couldn't get this working easily. boolean result = false; try {//from ww w .j a va 2 s . c om context.detectExternalChanges = false; context.wizardWindow.disableNavigation(); seedingTable.setEnabled(false); context.wizardWindow.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); result = commitChanges(); } finally { context.wizardWindow.enableNavigation(); seedingTable.setEnabled(true); context.wizardWindow.setCursor(Cursor.getDefaultCursor()); if (!result) context.detectExternalChanges = true; } return result; }
From source file:no.imr.sea2data.stox.InstallerUtil.java
public static boolean installRstox(Window wnd, String ftpPath, String rFolder) { // String pkgFile = getIOTempDirFile(RSTOX + TARGZ); // retrieveRstox(ftpPath, pkgFile); wnd.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); try {/* w ww . j a v a 2 s. c o m*/ return RUtils.installRstox(ftpPath, rFolder); } finally { wnd.setCursor(Cursor.getDefaultCursor()); } }
From source file:de.main.sessioncreator.DesktopApplication1View.java
private void showReportPanel() { sessionWizardMenuItem.setEnabled(true); reviewVieMenuItem.setEnabled(true);//from w w w . j a v a 2 s . c o m sessionReportMenuItem.setEnabled(false); viewReviewsPanel.setVisible(false); mainPanel.validate(); wizardPanel.setVisible(false); mainPanel.validate(); reportOverviewTable.setVisible(false); reportPanel.setVisible(true); mainPanel.validate(); this.getFrame().setTitle("SessionCreator - Report"); //Backgroundprozess to fill data to the reportPanel class ReportData extends SwingWorker<DefaultTableModel, Void> { @Override protected DefaultTableModel doInBackground() throws Exception { rh.addReport(reportChartPanel); reportScrollPOverviewTabel.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); reportScrollPOverviewTabel.setToolTipText("Please wait..."); reportlblSum.setText("Sums of Charters done: <counting>"); progressBar.setIndeterminate(true); progressBar.setVisible(true); model = new DefaultTableModel(); reportOverviewTable.removeAll(); model = rh.getTableModel(); reportOverviewTable.setModel(model); reportOverviewTable.setVisible(true); String count = rh.getAllSessionCount(model); reportlblSum.setText("Sums of Charters done: " + count); String[] text = rh.getAllBugsAndIssues(); reportlblBug.setText(text[0]); reportlblIssue.setText(text[1]); return model; } @Override protected void done() { try { reportScrollPOverviewTabel.setCursor(Cursor.getDefaultCursor()); reportScrollPOverviewTabel.setToolTipText(""); progressBar.setIndeterminate(false); progressBar.setVisible(false); reportScrollPOverviewTabel.setEnabled(true); reportOverviewTable.setFillsViewportHeight(true); reportOverviewTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); TableRowSorter<DefaultTableModel> rowSorter = new TableRowSorter<DefaultTableModel>(model); reportOverviewTable.setRowSorter(rowSorter); rowSorter.setComparator(1, new Comparator<Integer>() { @Override public int compare(Integer int1, Integer int2) { return int1.intValue() - int2.intValue(); } }); TableColumn column = null; for (int i = 0; i < 2; i++) { column = reportOverviewTable.getColumnModel().getColumn(i); if (i == 1) { column.setPreferredWidth(10); //third column is bigger DefaultTableCellRenderer myRenderer = new DefaultTableCellRenderer(); //Textalignment in second column right myRenderer.setHorizontalAlignment(SwingConstants.RIGHT); column.setCellRenderer(myRenderer); } else { column.setPreferredWidth(490); } } } catch ( /* InterruptedException, ExecutionException */Exception e) { } } } new ReportData().execute(); }
From source file:edu.harvard.i2b2.patientMapping.ui.PatientIDConversionJFrame.java
private void jConvertButtonActionPerformed(java.awt.event.ActionEvent evt) { int inputIndex = jInputComboBox.getSelectedIndex() + 1; int outputIndex = jOutputComboBox.getSelectedIndex() + 1; if ((inputIndex == 2 && outputIndex != 2) || (inputIndex == 4 && outputIndex != 5)) { Display.getDefault().syncExec(new Runnable() { public void run() { MessageBox messageBox = new MessageBox(new Shell(), SWT.ICON_WARNING | SWT.OK); messageBox.setText("Not valid selections"); messageBox.setMessage("Input and output pair selected is not valid."); messageBox.open();//w w w.j av a 2 s .c o m } }); return; } //jConvertButton.setCursor(new Cursor(Cursor.WAIT_CURSOR)); String inputFile = this.jInputFilePathTextField.getText(); if (inputFile == null || inputFile.equalsIgnoreCase("")) { JOptionPane.showMessageDialog(this, "Please select a input file."); return; } final String outputFile = this.jOutputFilePathTextField.getText(); if (outputFile == null || outputFile.equalsIgnoreCase("")) { JOptionPane.showMessageDialog(this, "Please select an output file."); return; } final File oDelete = new File(outputFile); Display.getDefault().syncExec(new Runnable() { public void run() { if (oDelete != null && oDelete.exists()) { MessageBox messageBox = new MessageBox(new Shell(), SWT.ICON_WARNING | SWT.YES | SWT.NO); messageBox.setText("Warning"); messageBox.setMessage(outputFile + " already exists,\nDo you want to replace it?"); int buttonID = messageBox.open(); switch (buttonID) { case SWT.YES: oDelete.delete(); break; case SWT.NO: return; case SWT.CANCEL: // does nothing ... } } } }); log.info("Selected output file: " + outputFile); //if (fileName != null && fileName.trim().length() > 0) { log.info("Selected input file: " + inputFile); PatientIDConversionFactory converter = new PatientIDConversionFactory(); if ((inputIndex == 1 && (outputIndex == 2 || outputIndex == 3)) || (inputIndex == 3 && (outputIndex == 5 || outputIndex == 6))) { converter.sitename(jSiteTextField.getText()); } FileReader fr; BufferedReader inbr = null; RandomAccessFile f = null; //append(f, resultFile.toString()); jConvertButton.setCursor(new Cursor(Cursor.WAIT_CURSOR)); try { f = new RandomAccessFile(outputFile, "rw"); fr = new FileReader(new File(inputFile)); inbr = new BufferedReader(fr); //String line = inbr.readLine(); /*if(!line.startsWith("@@i2b2 patient mapping file@@")) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { //setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); JOptionPane.showMessageDialog(jLabel1, "The file is not in a valid format.", "Error importing", JOptionPane.ERROR_MESSAGE); } }); //JOptionPane.showMessageDialog(null, "The file is not a valid.", "Error importing", JOptionPane.ERROR_MESSAGE); return; }*/ String line = inbr.readLine(); //log.info("column name: "+line); int rowCount = 0; while (line != null) { log.info(line); String outputline = ""; /*String[] cols = line.split(","); String id; if(cols.length < 2) { id = ""; } else { id = converter.convert(cols[1], 1, 1); }*/ outputline = converter.convertLine(line, inputIndex, outputIndex); append(f, outputline);//cols[0]+","+id+"\n"); rowCount++; line = inbr.readLine(); } log.info("From " + inputIndex + " to " + outputIndex + " total lines: " + rowCount); inbr.close(); f.close(); } catch (Exception e) { e.printStackTrace(); if (inbr != null) { try { inbr.close(); } catch (Exception e1) { } } if (f != null) { try { f.close(); } catch (Exception e1) { } } } jConvertButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); }
From source file:nz.govt.natlib.ndha.manualdeposit.CMSSearchResults.java
public void setWaitCursor(boolean isWaiting) { // NOPMD glass.setVisible(isWaiting);//from ww w .j a v a 2 s. com if (isWaiting) { final Cursor hourglass = new Cursor(Cursor.WAIT_CURSOR); setCursor(hourglass); } else { final Cursor normal = new Cursor(Cursor.DEFAULT_CURSOR); setCursor(normal); } }
From source file:com.smanempat.controller.ControllerEvaluation.java
public void proccessMining(JTable tableDataSetModel, JTable tableDataSetTesting, JTextField txtNumberOfK, JLabel labelPesanError, JTabbedPane jTabbedPane1, JTable tableResult, JTable tableConfMatrix, JTable tableTahunTesting, JLabel totalAccuracy, JPanel panelChart, JPanel panelChart1, JPanel panelChart2, JRadioButton singleTesting, JRadioButton multiTesting, JTextArea txtArea) throws SQLException { Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR); modelEvaluation = new ModelEvaluation(); int rowCountModel = tableDataSetModel.getRowCount(); int rowCountTest = tableDataSetTesting.getRowCount(); int[] tempK;/*from w w w . j av a 2 s . co m*/ double[][] tempEval; double[][] evalValue; boolean valid = false; /*Validasi Dataset Model dan Dataset Uji*/ if (rowCountModel == 0) { JOptionPane.showMessageDialog(null, "Pilih dataset model terlebih dahulu!", "Error", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png"))); txtNumberOfK.requestFocus(); } else if (rowCountTest == 0) { JOptionPane.showMessageDialog(null, "Pilih dataset uji terlebih dahulu!", "Error", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png"))); txtNumberOfK.requestFocus(); } else { valid = true; } /*Validasi Dataset Model dan Dataset Uji*/ if (valid == true) { if (multiTesting.isSelected()) { String iterasi = JOptionPane.showInputDialog("Input Jumlah Iterasi Pengujian :"); boolean validMulti = false; if (iterasi != null) { /*Validasi Jumlah Iterasi*/ if (Pattern.matches("[0-9]+", iterasi) == false && iterasi.length() > 0) { JOptionPane.showMessageDialog(null, "Nilai iterasi tidak valid!", "Error", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png"))); } else if (iterasi.isEmpty()) { JOptionPane.showMessageDialog(null, "Nilai iterasi tidak boleh kosong!", "Error", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png"))); } else if (iterasi.length() == 9) { JOptionPane.showMessageDialog(null, "Nilai iterasi terlalu panjang!", "Error", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png"))); } else if (rowCountTest > rowCountModel) { JOptionPane.showMessageDialog(null, "Data Uji tidak boleh lebih besar daripada data Model!", "Error", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png"))); } else { validMulti = true; System.out.println("valiMulti = " + validMulti + " Kok"); } /*Validasi Jumlah Iterasi*/ } if (validMulti == true) { tempK = new int[Integer.parseInt(iterasi)]; evalValue = new double[3][tempK.length]; for (int i = 0; i < Integer.parseInt(iterasi); i++) { validMulti = false; String k = JOptionPane .showInputDialog("Input Nilai Nearest Neighbor (k) ke " + (i + 1) + " :"); if (k != null) { /*Validasi Nilai K Tiap Iterasi*/ if (Pattern.matches("[0-9]+", k) == false && k.length() > 0) { JOptionPane.showMessageDialog(null, "Nilai nearest neighbor (k) tidak valid!", "Error", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png"))); } else if (k.isEmpty()) { JOptionPane.showMessageDialog(null, "Nilai nearest neighbor (k) tidak boleh kosong!", "Error", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png"))); } else if (k.length() == 9) { JOptionPane.showMessageDialog(null, "Nilai nearest neighbor (k) terlalu panjang!", "Error", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png"))); } else { validMulti = true; } /*Validasi Nilai K Tiap Iterasi*/ } if (validMulti == true) { tempK[i] = Integer.parseInt(k); System.out.println(tempK[i]); } else { break; } } if (validMulti == true) { for (int i = 0; i < tempK.length; i++) { int kValue = tempK[i]; String[][] modelValue = getModelValue(rowCountModel, tableDataSetModel); double[][] testValue = getTestvalue(rowCountTest, tableDataSetTesting); String[] knnValue = getKNNValue(rowCountModel, rowCountTest, modelValue, testValue, kValue); tempEval = evaluationModel(tableResult, tableConfMatrix, totalAccuracy, tableTahunTesting, tableDataSetTesting, knnValue, i, tempK, panelChart); //Menampung nilai Accuracy evalValue[0][i] = tempEval[0][i]; //Menampung nilai Recall evalValue[1][i] = tempEval[1][i]; //Menampung nilai Precision evalValue[2][i] = tempEval[2][i]; jTabbedPane1.setSelectedIndex(1); txtArea.append( "Tingkat Keberhasilan Sistem dengan Nilai Number of Nearest Neighbor (K) = " + tempK[i] + "\n"); txtArea.append("Akurasi\t\t: " + evalValue[0][i] * 100 + " %\n"); txtArea.append("Recall\t\t: " + evalValue[1][i] * 100 + " %\n"); txtArea.append("Precision\t: " + evalValue[2][i] * 100 + " %\n"); txtArea.append( "=============================================================================\n"); } showChart(tempK, evalValue, panelChart, panelChart1, panelChart2); } } } else if (singleTesting.isSelected()) { boolean validSingle = false; String k = txtNumberOfK.getText(); int nilaiK = 0; evalValue = new double[3][1]; /*Validasi Nilai Number of Nearest Neighbor*/ if (Pattern.matches("[0-9]+", k) == false && k.length() > 0) { labelPesanError.setText("Number of Nearest Neighbor tidak valid"); JOptionPane.showMessageDialog(null, "Number of Nearest Neighbor tidak valid!", "Error", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png"))); txtNumberOfK.requestFocus(); } else if (k.isEmpty()) { JOptionPane.showMessageDialog(null, "Number of Nearest Neighbor tidak boleh kosong!", "Error", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png"))); labelPesanError.setText("Number of Nearest Neighbor tidak boleh kosong"); txtNumberOfK.requestFocus(); } else if (rowCountModel == 0 && Integer.parseInt(k) >= rowCountModel) { JOptionPane.showMessageDialog(null, "Pilih dataset model terlebih dahulu!", "Error", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png"))); txtNumberOfK.requestFocus(); } else if (rowCountTest == 0 && Integer.parseInt(k) >= rowCountTest) { JOptionPane.showMessageDialog(null, "Pilih dataset uji terlebih dahulu!", "Error", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png"))); txtNumberOfK.requestFocus(); } else if (Integer.parseInt(k) >= rowCountModel) { JOptionPane.showMessageDialog(null, "Number of Nearest Neighbor tidak boleh lebih dari " + rowCountModel + " !", "Error", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png"))); txtNumberOfK.requestFocus(); } else { validSingle = true; nilaiK = Integer.parseInt(k); } /*Validasi Nilai Number of Nearest Neighbor*/ if (validSingle == true) { int confirm; int i = 0; confirm = JOptionPane.showOptionDialog(null, "Yakin ingin memproses data?", "Proses Klasifikasi", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null); if (confirm == JOptionPane.OK_OPTION) { int kValue = Integer.parseInt(txtNumberOfK.getText()); String[][] modelValue = getModelValue(rowCountModel, tableDataSetModel); double[][] testValue = getTestvalue(rowCountTest, tableDataSetTesting); String[] knnValue = getKNNValue(rowCountModel, rowCountTest, modelValue, testValue, kValue); tempEval = evaluationModel(tableResult, tableConfMatrix, totalAccuracy, tableTahunTesting, tableDataSetTesting, knnValue, nilaiK, panelChart); evalValue[0][i] = tempEval[0][0]; evalValue[1][i] = tempEval[1][0]; evalValue[2][i] = tempEval[2][0]; jTabbedPane1.setSelectedIndex(1); } System.out.println("com.smanempat.controller.ControllerEvaluation.proccessMining()OKOKOK"); showChart(nilaiK, evalValue, panelChart, panelChart1, panelChart2); Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR); } } } }