List of usage examples for java.awt Cursor getDefaultCursor
public static Cursor getDefaultCursor()
From source file:au.com.jwatmuff.eventmanager.gui.main.MainWindow.java
private void networkLogMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_networkLogMenuItemActionPerformed try {//from ww w .java 2 s . c o m setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); WindowsNetUtil.logNetworkInfo(); } finally { setCursor(Cursor.getDefaultCursor()); } GUIUtils.displayMessage(null, "Network diagnostic information has been logged.\nThis will assist the developers to resolve network related issues with EventManager.", "Log Network Info"); }
From source file:de.juwimm.cms.content.panel.PanDocuments.java
/** * * @param files//ww w. j a v a 2 s . c o m * @param unit * @param documentId */ public void uploadFiles(File[] files, Integer unit, Integer viewComponentId, Integer documentId) { if ((files != null) && (files.length > 0)) { for (int i = (files.length - 1); i >= 0; i--) { File file = files[i]; FrmProgressDialog prog = new FrmProgressDialog( Messages.getString("panel.content.documents.addDocument"), Messages.getString("panel.content.upload.ParseFile"), 100); prog.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); try { String fext = Utils.getExtension(file); String mimetype = Utils.getMimeType4Extension(fext); if (mimetype.equals("")) { mimetype = "application/octet-stream"; } prog.setProgress(Messages.getString("panel.content.upload.Uploading"), 50); String password = null; if (mimetype.equals("application/pdf") && PdfUtils.isPassswordProtected(file)) { DlgPdfDocumentPassword dlgPdfDocumentPassword = new DlgPdfDocumentPassword(password); dlgPdfDocumentPassword.setSize(350, 280); dlgPdfDocumentPassword.setLocationRelativeTo(UIConstants.getMainFrame()); dlgPdfDocumentPassword.setModal(true); dlgPdfDocumentPassword.setVisible(true); dlgPdfDocumentPassword.pack(); password = dlgPdfDocumentPassword.getPassword(); } int existingDocId = -1; if (unit != null) { existingDocId = comm.getDocumentIdForNameAndUnit(file.getName(), unit); } else if (viewComponentId != null) { existingDocId = comm.getDocumentIdForNameAndViewComponent(file.getName(), viewComponentId); } else { throw new RuntimeException( "There must be at least one of unitId or viewComponentId present in method call"); } //this.intDocId = this.comm.addOrUpdateDocument(file, unit, file.getName(), mimetype, documentId); if (!isDataActualization) { if (existingDocId == 0) { try { DocumentValue documentValue = new DocumentValue(); // documentValue.setDescription(txtDocumentDescription.getText()); documentValue.setDocument(IOUtils.toByteArray(new FileInputStream(file))); documentValue.setDocumentId(documentId); documentValue.setDocumentName(file.getName()); // documentValue.setLabel(txtDocumentLabel.getText()); documentValue.setMimeType(mimetype); documentValue.setPassword(password); // documentValue.setSearchable(ckbDocumentSearchable.isSelected()); documentValue.setUnitId(unit); documentValue.setViewDocumentId(viewComponentId); this.intDocId = this.comm.addOrUpdateDocument(documentValue).getDocumentId(); } catch (InvalidSizeException e) { JOptionPane.showMessageDialog(UIConstants.getMainFrame(), e.getMessage(), rb.getString("dialog.title"), JOptionPane.INFORMATION_MESSAGE); return; } } else { DlgSaveDocument saveDialog = new DlgSaveDocument(file, unit, file.getName(), mimetype, existingDocId); int frameHeight = 280; int frameWidth = 350; saveDialog.setSize(frameWidth, frameHeight); saveDialog.setLocationRelativeTo(UIConstants.getMainFrame()); saveDialog.setModal(true); saveDialog.setVisible(true); } } else { if ((existingDocId == 0) || (file.getName().equalsIgnoreCase(selectedDocName))) { try { DocumentValue documentValue = new DocumentValue(); documentValue.setDescription(txtDocumentDescription.getText()); documentValue.setDocument(IOUtils.toByteArray(new FileInputStream(file))); documentValue.setDocumentId(documentId); documentValue.setDocumentName(file.getName()); documentValue.setLabel(txtDocumentLabel.getText()); documentValue.setMimeType(mimetype); documentValue.setPassword(password); documentValue.setSearchable(ckbDocumentSearchable.isSelected()); documentValue.setAuthor(txtAuthor.getText()); documentValue.setCategory(txtCategory.getText()); documentValue.setUnitId(unit); documentValue.setViewDocumentId(viewComponentId); this.intDocId = this.comm.addOrUpdateDocument(documentValue).getDocumentId(); } catch (InvalidSizeException e) { JOptionPane.showMessageDialog(UIConstants.getMainFrame(), e.getMessage(), rb.getString("dialog.title"), JOptionPane.INFORMATION_MESSAGE); return; } } else if ((existingDocId != 0) && (!file.getName().equalsIgnoreCase(selectedDocName))) { JOptionPane.showMessageDialog(UIConstants.getMainFrame(), Messages.getString("dialog.saveDocument.imposibleToOverwrite"), rb.getString("dialog.title"), JOptionPane.INFORMATION_MESSAGE); } } } catch (Exception exe) { log.error("Error upload document " + file.getName(), exe); } finally { prog.setProgress(Messages.getString("panel.content.upload.Finished"), 100); prog.dispose(); prog.setCursor(Cursor.getDefaultCursor()); } } } }
From source file:au.com.jwatmuff.eventmanager.gui.main.MainWindow.java
private void manualAddPeerMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_manualAddPeerMenuItemActionPerformed String hostname = JOptionPane .showInputDialog("Enter an IP Address, Host or Computer Name on which EventManager is running."); if (!StringUtils.isBlank(hostname)) { try {//from w ww . j a v a2s.c o m setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); InetAddress.getByName(hostname); GUIUtils.displayMessage(null, "The computer '" + hostname + "' was successfully added.\nIf EventManager is able to connect to this computer, it will appear under the chat user list shortly", "Computer added"); manuallyAddHost(hostname); } catch (UnknownHostException e) { GUIUtils.displayError(null, "EventManager was unable to identify any computer named '" + hostname + "' (Unknown host)"); } finally { setCursor(Cursor.getDefaultCursor()); } } }
From source file:com.signalcollect.sna.visualization.SignalCollectSNATopComponent.java
/** * Gets and visualizes the chart of the Local Cluster Coefficient * Distribution// ww w .java2 s .c o m * * @param evt */ private void clusterDistributionButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clusterDistributionButtonActionPerformed try { mainPanel.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); if (jTextArea1.getText() == null) { throw new IllegalArgumentException("No file was chosen!\nPlease choose a valid .gml file"); } if (!jTextArea1.getText().contains(".gml")) { throw new IllegalArgumentException( "The chosen file doesn't have the right format!\nPlease choose a valid .gml file"); } distributionFrame.setVisible(false); distributionFrame = new JFrame(); scgc = new LocalClusterCoefficientSignalCollectGephiConnectorImpl(fileName); JFreeChart chart = scgc.createClusterDistributionChart(scgc.getClusterDistribution()); ChartPanel chartPanel = new ChartPanel(chart); Dimension dim = new Dimension(750, 450); distributionFrame.setMinimumSize(dim); chartPanel.setVisible(true); chartPanel.validate(); distributionFrame.add(chartPanel); distributionFrame.pack(); distributionFrame.setVisible(true); } catch (IllegalArgumentException exception) { messageFrame = new JFrame(); JOptionPane.showMessageDialog(messageFrame, exception.getMessage(), "Signal/Collect Error", JOptionPane.ERROR_MESSAGE); } catch (Exception exception) { messageFrame = new JFrame(); exception.printStackTrace(); JOptionPane.showMessageDialog(messageFrame, "Technical exception happened (" + exception.getCause() + ")", "Signal/Collect Error", JOptionPane.ERROR_MESSAGE); } finally { mainPanel.setCursor(Cursor.getDefaultCursor()); } }
From source file:com.signalcollect.sna.visualization.SignalCollectSNATopComponent.java
/** * Executes the label propagation algorithm * * @param evt//from w ww . ja v a 2s. c o m */ private void labelPropagationButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_labelPropagationButtonActionPerformed try { mainPanel.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); if (jTextPane1.getText() == null) { throw new IllegalArgumentException("No input found!"); } if (Integer.parseInt(jTextPane1.getText()) < 1) { throw new IllegalArgumentException("The number has to be greater than 0"); } scgc = new LabelPropagationSignalCollectGephiConnectorImpl(fileName, scala.Option.apply(Integer.parseInt(jTextPane1.getText()))); scgc.getLabelPropagation(); } catch (IllegalArgumentException exception) { JOptionPane.showMessageDialog(messageFrame, "Error when parsing input " + jTextPane1.getText() + ": " + exception.getMessage(), "Signal/Collect Error", JOptionPane.ERROR_MESSAGE); } catch (Exception exception) { messageFrame = new JFrame(); exception.printStackTrace(); JOptionPane.showMessageDialog(messageFrame, "Technical exception happened (" + exception.getCause() + ")", "Signal/Collect Error", JOptionPane.ERROR_MESSAGE); } finally { scgc = null; mainPanel.setCursor(Cursor.getDefaultCursor()); } }
From source file:com.nbt.TreeFrame.java
public void doImportDat(final File file) { Cursor waitCursor = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR); setCursor(waitCursor);// w w w . j a va 2 s .c o m SwingWorkerUnlimited.execure(new SwingWorker<CompoundTag, Void>() { @Override protected CompoundTag doInBackground() throws Exception { NBTInputStream ns = null; try { ns = new NBTInputStream(new FileInputStream(file)); return (CompoundTag) ns.readTag(); } finally { IOUtils.closeQuietly(ns); } } @Override protected void done() { CompoundTag tag = null; try { tag = get(); } catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); Throwable cause = ExceptionUtils.getRootCause(e); showErrorDialog(cause.getMessage()); return; } textFile.setText(file.getAbsolutePath()); updateTreeTable(tag); Cursor defaultCursor = Cursor.getDefaultCursor(); setCursor(defaultCursor); } }); }
From source file:com.nbt.TreeFrame.java
public void doImportMCR(final File file) { Cursor waitCursor = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR); setCursor(waitCursor);//w ww . j av a 2s . com SwingWorkerUnlimited.execure(new SwingWorker<Region, Void>() { @Override protected Region doInBackground() throws Exception { NBTRegion region = new NBTRegion(file); region.getChunks(); // load from disk return region; } @Override protected void done() { Region region = null; try { region = get(); } catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); Throwable cause = ExceptionUtils.getRootCause(e); showErrorDialog(cause.getMessage()); return; } textFile.setText(file.getAbsolutePath()); updateTreeTable(region); Cursor defaultCursor = Cursor.getDefaultCursor(); setCursor(defaultCursor); } }); }
From source file:jp.massbank.spectrumsearch.SearchPage.java
/** * DB/*from w w w .j ava2 s . co m*/ * ???DB?? * @param ps * @param precursor * @param queryName ??? * @param queryKey */ private void searchDb(String[] ps, String precursor, String queryName, String queryKey) { initSearchParameterSetting(); queryPlot.clear(); compPlot.clear(); resultPlot.clear(); queryPlot.setPeaks(null, 0); compPlot.setPeaks(null, 1); resultPlot.setPeaks(null, 0); DefaultTableModel dataModel = (DefaultTableModel) resultSorter.getTableModel(); dataModel.setRowCount(0); hitLabel.setText(""); if (queryTabPane.getSelectedIndex() == TAB_ORDER_DB) { queryPlot.setSpectrumInfo(queryName, queryKey, precursor, PeakPanel.SP_TYPE_QUERY, false); } else if (queryTabPane.getSelectedIndex() == TAB_ORDER_FILE) { queryPlot.setSpectrumInfo(queryName, queryKey, precursor, PeakPanel.SP_TYPE_QUERY, true); } // ?????? if (ps.length == 0 || (ps.length == 1 && ps[0].split("\t")[0].equals("0") && ps[0].split("\t")[1].equals("0"))) { queryPlot.setNoPeak(true); StringBuilder sb = new StringBuilder(); sb.append(" 0 Hit. ("); sb.append((PRECURSOR < 1) ? "" : "Precursor : " + PRECURSOR + ", "); sb.append("Tolerance : "); sb.append(" "); sb.append((tolUnit1.isSelected()) ? tolUnit1.getText() : tolUnit2.getText()); sb.append(", Cutoff threshold : " + CUTOFF_THRESHOLD + ")"); hitLabel.setText(sb.toString()); // hitLabel.setText(" 0 Hit. (" // + ((PRECURSOR < 1) ? "" : "Precursor : " + PRECURSOR + ", ") // + "Tolerance : " // + TOLERANCE // + " " // + ((tolUnit1.isSelected()) ? tolUnit1.getText() : tolUnit2.getText()) + ", Cutoff threshold : " // + CUTOFF_THRESHOLD + ")"); // ? this.setCursor(Cursor.getDefaultCursor()); return; } // POST? final SearchQueryParam param = new SearchQueryParam(); // StringBuffer post = new StringBuffer(); if (isRecInteg) { param.setInteg(true); // post.append( "INTEG=true&" ); } else if (isRecActu) { param.setInteg(false); // post.append( "INTEG=false&" ); } if (PRECURSOR > 0) { param.setPrecursor(PRECURSOR); // post.append( "PRE=" + PRECURSOR + "&"); } param.setCutoff(CUTOFF_THRESHOLD); // post.append( "CUTOFF=" + CUTOFF_THRESHOLD + "&" ); param.setTolerance(TOLERANCE); // post.append( "TOLERANCE=" + TOLERANCE + "&" ); if (tolUnit2.isSelected()) { param.setTolUnit(ToleranceUnit.PPM.getLabel()); // post.append( "TOLUNIT=ppm&" ); } else { param.setTolUnit(ToleranceUnit.UNIT.getLabel()); // post.append( "TOLUNIT=unit&" ); } StringBuffer sbInstance = new StringBuffer(); // post.append( "INST=" ); boolean isAllInstanceSelected = true; for (Entry<String, Boolean> entry : isInstCheck.entrySet()) { if (entry.getValue()) { if (sbInstance.length() > 0) { sbInstance.append(","); } sbInstance.append(entry.getKey()); } else { isAllInstanceSelected = false; } } // for (Iterator i=isInstCheck.keySet().iterator(); i.hasNext();) { // String key = (String)i.next(); // // if ( (isInstCheck.get(key)) ) { // if (sbInstance.length() > 0) { // sbInstance.append( "," ); // } // sbInstance.append( key ); // } else { // isInstAll = false; // } // } if (isAllInstanceSelected) { if (sbInstance.length() > 0) { sbInstance.append(","); } sbInstance.append("ALL"); } param.setInstType(sbInstance.toString()); // post.append( instTmp.toString() + "&" ); StringBuffer sbMs = new StringBuffer(); // post.append( "MS=" ); boolean isAllMsSelected = true; for (Entry<String, Boolean> entry : isMsCheck.entrySet()) { if (entry.getValue()) { if (sbMs.length() > 0) { sbMs.append(","); } sbMs.append(entry.getKey()); } else { isAllMsSelected = false; } } // for (Iterator i=isMsCheck.keySet().iterator(); i.hasNext(); ) { // String key = (String)i.next(); // // if ( (isMsCheck.get(key)) ) { // if (msTmp.length() > 0) { // msTmp.append( "," ); // } // msTmp.append( key ); // } else { // isMsAll = false; // } // } if (isAllMsSelected) { if (sbMs.length() > 0) { sbMs.append(","); } sbMs.append("ALL"); } param.setMsType(sbMs.toString()); // post.append( msTmp.toString() + "&" ); if (isIonRadio.get(IonMode.POSITIVE.getKey())) { // if (isIonRadio.get("Posi")) { param.setIon(1); // post.append( "ION=1&" ); } else if (isIonRadio.get(IonMode.NEGATIVE.getKey())) { // } else if (isIonRadio.get("Nega")) { param.setIon(-1); // post.append( "ION=-1&" ); } else { param.setIon(0); // post.append( "ION=0&"); } StringBuffer sbPeakValue = new StringBuffer(); // post.append( "VAL=" ); for (int i = 0; i < ps.length; i++) { sbPeakValue.append(ps[i].replace("\t", ",") + "@"); } param.setPeak(sbPeakValue.toString()); // ??? setOperationEnbled(false); // ? dlg.showDialog(); // this.param = post.toString(); this.ps = ps; SwingWorker worker = new SwingWorker() { private ArrayList<String> result = null; public Object construct() { // ??-??CGI SearchLogic searchLogic = new SearchLogic(); result = searchLogic.getSearchResult(param); return null; // String cgiType = MassBankCommon.CGI_TBL[MassBankCommon.CGI_TBL_NUM_TYPE][MassBankCommon.CGI_TBL_TYPE_SEARCH]; // result = mbcommon.execMultiDispatcher(baseUrl, cgiType, SearchPage.this.param); // return null; } public void finished() { // ??? setOperationEnbled(true); // ??? dlg.hideDialog(); int total = 0; if (result != null && result.size() > 0) { total = result.size(); List<GuiResultTableRow> guiResultTableRows = new ArrayList<GuiResultTableRow>(); // ?DBTable? for (int i = 0; i < total; i++) { String line = (String) result.get(i); String[] item = line.replace("\n", StringUtils.EMPTY).split("\t"); String recordId = item[0]; String recordTitle = item[1]; // Score, Hit String strScore = StringUtils.EMPTY; String strHit = StringUtils.EMPTY; String hitScore = item[2]; int pos = hitScore.indexOf("."); if (pos > 0) { strScore = "0" + hitScore.substring(pos); strHit = hitScore.substring(0, pos); } else { strScore = "0"; strHit = hitScore; } Double score = Double.parseDouble(strScore); Integer hit = Integer.parseInt(strHit); // Ion int iIon = Integer.parseInt(item[3]); String strIonMode = StringUtils.EMPTY; if (iIon > 0) { strIonMode = "P"; } else if (iIon < 0) { strIonMode = "N"; } else { strIonMode = "-"; } // SiteName String contributor = SiteUtil.getSiteNameByRecordId(recordId); GuiResultTableRow guiResultTableRow = new GuiResultTableRow((i + 1), recordId, recordTitle, contributor, score, hit, strIonMode); guiResultTableRows.add(guiResultTableRow); } fillGuiResultTableData(guiResultTableRows); } PeakData peak = new PeakData(SearchPage.this.ps); queryPlot.setPeaks(peak, 0); compPlot.setPeaks(peak, 0); resultTabPane.setSelectedIndex(0); setAllPlotAreaRange(queryPlot); SearchPage.this.setCursor(Cursor.getDefaultCursor()); StringBuilder sbHitLabel = new StringBuilder(); sbHitLabel.append(" "); sbHitLabel.append(total); sbHitLabel.append(" Hit. ("); sbHitLabel.append((PRECURSOR < 1) ? "" : "Precursor : " + PRECURSOR + ", "); sbHitLabel.append("Tolerance : "); sbHitLabel.append(TOLERANCE); sbHitLabel.append(" "); sbHitLabel.append((tolUnit1.isSelected()) ? tolUnit1.getText() : tolUnit2.getText()); sbHitLabel.append(", Cutoff threshold : "); sbHitLabel.append(CUTOFF_THRESHOLD); sbHitLabel.append(")"); hitLabel.setText(sbHitLabel.toString()); hitLabel.setToolTipText(sbHitLabel.toString()); // hitLabel.setText(" " // + total // + " Hit. (" // + ((PRECURSOR < 1) ? "" : "Precursor : " + PRECURSOR + ", ") // + "Tolerance : " // + TOLERANCE // + " " // + ((tolUnit1.isSelected()) ? tolUnit1.getText() // : tolUnit2.getText()) + ", Cutoff threshold : " // + CUTOFF_THRESHOLD + ")"); // hitLabel.setToolTipText(" " // + total // + " Hit. (" // + ((PRECURSOR < 1) ? "" : "Precursor : " + PRECURSOR + ", ") // + "Tolerance : " // + TOLERANCE // + " " // + ((tolUnit1.isSelected()) ? tolUnit1.getText() // : tolUnit2.getText()) + ", Cutoff threshold : " // + CUTOFF_THRESHOLD + ")"); } }; worker.start(); }
From source file:com.nbt.TreeFrame.java
public void doImportDirectory(final File base) { Cursor waitCursor = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR); setCursor(waitCursor);//from w w w .j a v a2 s.co m SwingWorkerUnlimited.execure(new SwingWorker<NBTBranch, Void>() { @Override protected NBTBranch doInBackground() throws Exception { return createBranch(base); } // TODO: avoid duplicate code in NBTFileBranch#createBranchCache() private NBTBranch createBranch(File file) { String[] names = file.list(); if (ArrayUtils.contains(names, WorldDirectory.DIRECTORY_REGION)) return new NBTWorld(file); return new NBTFileBranch(file); } @Override protected void done() { NBTBranch branch = null; try { branch = get(); } catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); Throwable cause = ExceptionUtils.getRootCause(e); showErrorDialog(cause.getMessage()); return; } textFile.setText(base.getAbsolutePath()); updateTreeTable(branch); Cursor defaultCursor = Cursor.getDefaultCursor(); setCursor(defaultCursor); } }); }
From source file:org.languagetool.gui.Main.java
private void unsetWaitCursor() { frame.setCursor(Cursor.getDefaultCursor()); textArea.setCursor(Cursor.getDefaultCursor()); resultArea.setCursor(Cursor.getDefaultCursor()); }