List of usage examples for java.awt Cursor getPredefinedCursor
public static Cursor getPredefinedCursor(int type)
From source file:com.nbt.TreeFrame.java
public void doImportMCR(final File file) { Cursor waitCursor = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR); setCursor(waitCursor);/*www .j a va2s. c o m*/ 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:org.fhaes.gui.AnalysisResultsPanel.java
/** * Draw the analysis results table depending on the current tree-node forcing the GUI to refresh regardless * /*from w ww . j a va 2 s . c o m*/ * @param forceRefresh */ public void setupTable(Boolean forceRefresh) { cl.show(cards, RESULTSPANEL); MainWindow.getInstance().getReportPanel().actionResultsHelp.setEnabled(true); goldFishPanel.setParamsText(); try { log.debug("Setting cursor to wait"); table.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); treeResults.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); DefaultMutableTreeNode selectednode = (DefaultMutableTreeNode) treeResults .getLastSelectedPathComponent(); if (selectednode == null) { clearTable(); return; } log.debug("Node selected: " + selectednode.toString()); // If selection hasn't changed don't do anything if (previouslySelectedNode != null && selectednode.equals(previouslySelectedNode) && !forceRefresh) { log.debug("Node selection hasn't changed so not doing anything"); return; } previouslySelectedNode = selectednode; if (!(selectednode instanceof FHAESResultTreeNode)) { clearTable(); return; } FHAESResultTreeNode resultnode = (FHAESResultTreeNode) treeResults.getLastSelectedPathComponent(); FHAESResult result = resultnode.getFHAESResult(); panelResult.setBorder(new TitledBorder(null, result.getFullName(), TitledBorder.LEADING, TitledBorder.TOP, null, null)); if (result.equals(FHAESResult.SEASONALITY_SUMMARY)) { log.debug("Seasonality summary node selected"); if (seasonalitySummaryModel == null) { clearTable(); return; } table.setModel(seasonalitySummaryModel); // table.setSortOrder(0, SortOrder.ASCENDING); setDefaultTableAlignment(SwingConstants.RIGHT); } else if (result.equals(FHAESResult.INTERVAL_SUMMARY)) { log.debug("Interval summary node selected"); if (intervalsSummaryModel == null) { clearTable(); return; } table.setModel(intervalsSummaryModel); // table.setSortOrder(0, SortOrder.ASCENDING); setDefaultTableAlignment(SwingConstants.RIGHT); } else if (result.equals(FHAESResult.INTERVAL_EXCEEDENCE_TABLE)) { log.debug("Interval exceedence node selected"); if (intervalsExceedenceModel == null) { clearTable(); return; } table.setModel(intervalsExceedenceModel); // table.setSortOrder(0, SortOrder.ASCENDING); setDefaultTableAlignment(SwingConstants.RIGHT); } else if (result.equals(FHAESResult.BINARY_MATRIX_00)) { if (this.bin00Model == null) { clearTable(); return; } table.setModel(bin00Model); // table.setSortOrder(0, SortOrder.ASCENDING); setDefaultTableAlignment(SwingConstants.RIGHT); } else if (result.equals(FHAESResult.BINARY_MATRIX_01)) { if (this.bin01Model == null) { clearTable(); return; } table.setModel(bin01Model); // table.setSortOrder(0, SortOrder.ASCENDING); setDefaultTableAlignment(SwingConstants.RIGHT); } else if (result.equals(FHAESResult.BINARY_MATRIX_10)) { if (this.bin10Model == null) { clearTable(); return; } table.setModel(bin10Model); // table.setSortOrder(0, SortOrder.ASCENDING); setDefaultTableAlignment(SwingConstants.RIGHT); } else if (result.equals(FHAESResult.BINARY_MATRIX_11)) { if (this.bin11Model == null) { clearTable(); return; } table.setModel(bin11Model); // table.setSortOrder(0, SortOrder.ASCENDING); setDefaultTableAlignment(SwingConstants.RIGHT); } else if (result.equals(FHAESResult.BINARY_MATRIX_SUM)) { if (this.binSumModel == null) { clearTable(); return; } table.setModel(binSumModel); setDefaultTableAlignment(SwingConstants.RIGHT); } else if (result.equals(FHAESResult.JACCARD_SIMILARITY_MATRIX)) { if (this.SJACModel == null) { clearTable(); return; } table.setModel(SJACModel); setDefaultTableAlignment(SwingConstants.RIGHT); } else if (result.equals(FHAESResult.COHEN_SIMILARITITY_MATRIX)) { if (this.SCOHModel == null) { clearTable(); return; } table.setModel(SCOHModel); setDefaultTableAlignment(SwingConstants.RIGHT); } else if (result.equals(FHAESResult.JACCARD_SIMILARITY_MATRIX_D)) { if (this.DSJACModel == null) { clearTable(); return; } table.setModel(DSJACModel); setDefaultTableAlignment(SwingConstants.RIGHT); } else if (result.equals(FHAESResult.COHEN_SIMILARITITY_MATRIX_D)) { if (this.DSCOHModel == null) { clearTable(); return; } table.setModel(DSCOHModel); setDefaultTableAlignment(SwingConstants.RIGHT); } else if (result.equals(FHAESResult.BINARY_MATRIX_NTP)) { log.debug("doing NTP"); if (this.NTPModel == null) { log.debug("fileNTP is null so clearing table"); clearTable(); return; } table.setModel(NTPModel); setDefaultTableAlignment(SwingConstants.RIGHT); } else if (result.equals(FHAESResult.BINARY_MATRIX_SITE)) { if (this.siteSummaryModel == null) { clearTable(); return; } table.setModel(siteSummaryModel); setDefaultTableAlignment(SwingConstants.RIGHT); } else if (result.equals(FHAESResult.BINARY_MATRIX_TREE)) { if (this.treeSummaryModel == null) { clearTable(); return; } table.setModel(treeSummaryModel); setDefaultTableAlignment(SwingConstants.RIGHT); } else if (result.equals(FHAESResult.GENERAL_SUMMARY)) { if (this.generalSummaryModel == null) { clearTable(); return; } table.setModel(generalSummaryModel); setDefaultTableAlignment(SwingConstants.RIGHT); } else if (result.equals(FHAESResult.SINGLE_FILE_SUMMARY)) { if (this.singleFileSummaryModel == null) { clearTable(); return; } table.setModel(singleFileSummaryModel); setDefaultTableAlignment(SwingConstants.RIGHT); } else if (result.equals(FHAESResult.SINGLE_EVENT_SUMMARY)) { if (this.singleEventSummaryModel == null) { clearTable(); return; } table.setModel(singleEventSummaryModel); setDefaultTableAlignment(SwingConstants.RIGHT); setTableColumnAlignment(SwingConstants.LEFT, 2); } else { log.warn("Unhandled FHAESResult type"); clearTable(); } table.packAll(); table.setColumnControlVisible(true); table.setAutoCreateRowSorter(true); } catch (Exception e) { log.debug("Caught exception loading table data"); } finally { log.debug("Clearing cursor"); table.setCursor(Cursor.getDefaultCursor()); treeResults.setCursor(Cursor.getDefaultCursor()); } }
From source file:org.gumtree.vis.hist2d.Hist2DPanel.java
/** * Handles a 'mouse dragged' event.//from w w w .j ava 2s . c om * * @param e the mouse event. */ public void mouseDragged(MouseEvent e) { setHorizontalTraceLocation(e.getX()); setVerticalTraceLocation(e.getY()); Insets insets = getInsets(); int x = (int) ((e.getX() - insets.left) / getScaleX()); int y = (int) ((e.getY() - insets.top) / getScaleY()); EntityCollection entities = null; ChartEntity entity = null; if (getChartRenderingInfo() != null) { entities = getChartRenderingInfo().getEntityCollection(); if (entities != null) { entity = entities.getEntity(x, y); } } if (entity instanceof XYItemEntity) { IDataset dataset = (IDataset) ((XYItemEntity) entity).getDataset(); int item = ((XYItemEntity) entity).getItem(); setChartX(dataset.getXValue(0, item)); setChartY(dataset.getYValue(0, item)); setChartZ(((XYZDataset) dataset).getZValue(0, item)); } // if (isMaskingEnabled() && (e.getModifiers() & maskingKeyMask) != 0) { if (isMaskingEnabled()) { int cursorType = findCursorOnSelectedItem(e.getX(), e.getY()); setCursor(Cursor.getPredefinedCursor(cursorType)); } else if (getCursor() != defaultCursor) { setCursor(defaultCursor); } // we can only generate events if the panel's chart is not null // (see bug report 1556951) Object[] listeners = getListeners(ChartMouseListener.class); if (getChart() != null) { XYZChartMouseEvent event = new XYZChartMouseEvent(getChart(), e, entity); event.setXYZ(getChartX(), getChartY(), getChartZ()); for (int i = listeners.length - 1; i >= 0; i -= 1) { ((ChartMouseListener) listeners[i]).chartMouseMoved(event); } } if (getMaskDragIndicator() != Cursor.DEFAULT_CURSOR && getSelectedMask() != null && (e.getModifiers() & MouseEvent.BUTTON1_MASK) != 0) { changeSelectedMask(e, entities); } else if (isMaskingEnabled() && (e.getModifiers() & maskingKeyMask) != 0) { makeNewMask(e, entities); } else { super.mouseDragged(e); } }
From source file:edu.harvard.mcz.imagecapture.MainFrame.java
/** * This method initializes jMenuItemBrowseSpecimens * // w w w.j ava 2 s . com * @return javax.swing.JMenuItem */ private JMenuItem getJMenuItemBrowseSpecimens() { if (jMenuItemBrowseSpecimens == null) { jMenuItemBrowseSpecimens = new JMenuItem(); jMenuItemBrowseSpecimens.setText("Browse Specimens"); jMenuItemBrowseSpecimens.setMnemonic(KeyEvent.VK_B); try { jMenuItemBrowseSpecimens.setIcon(new ImageIcon(this.getClass() .getResource("/edu/harvard/mcz/imagecapture/resources/butterfly_icon_16px.png"))); } catch (Exception e) { log.error("Can't open icon file for jMenuItemBrowseImages."); log.error(e); } jMenuItemBrowseSpecimens.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { // Create a SpecimenBrowser jpanel and replace the // the content of the center of jPanelCenter with it. //TODO: extend beyond switching between ilb and slb. Singleton.getSingletonInstance().getMainFrame() .setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); slb = new SpecimenBrowser(); if (ilb != null) { jPanelCenter.remove(ilb); } if (ulb != null) { jPanelCenter.remove(ulb); } jPanelCenter.removeAll(); jPanelCenter.add(slb, BorderLayout.CENTER); jPanelCenter.revalidate(); jPanelCenter.repaint(); if (Singleton.getSingletonInstance().getProperties().getProperties() .getProperty(ImageCaptureProperties.KEY_ENABLE_BROWSE).equals("false")) { jMenuItemBrowseSpecimens.setEnabled(true); jMenuItemBrowseImages.setEnabled(true); } else { jMenuItemBrowseSpecimens.setEnabled(true); jMenuItemBrowseImages.setEnabled(true); } setStatusMessage("Found " + slb.getRowCount() + " specimens"); Singleton.getSingletonInstance().getMainFrame() .setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); System.gc(); } }); } if (Singleton.getSingletonInstance().getProperties().getProperties() .getProperty(ImageCaptureProperties.KEY_ENABLE_BROWSE).equals("false")) { jMenuItemBrowseSpecimens.setEnabled(false); } return jMenuItemBrowseSpecimens; }
From source file:com.nbt.TreeFrame.java
public void doImportDirectory(final File base) { Cursor waitCursor = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR); setCursor(waitCursor);/*from www . j a va 2s.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.fhaes.fhsamplesize.view.FHSampleSize.java
/** * Run the actual analysis task. This function calls a SwingWorker task so the GUI remains responsive during processing. */// w w w.j av a 2 s. co m private void runSSIZAnalysisTask() { setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); mouseListenersActive = false; this.getContentPane().add(panelProgressBar, BorderLayout.SOUTH); panelProgressBar.setVisible(true); progressBar.setValue(0); // Enable and disable the appropriate GUI components during analysis actionBrowse.setEnabled(false); actionExportPDF.setEnabled(false); actionExportPNG.setEnabled(false); actionRun.setEnabled(false); actionSaveTable.setEnabled(false); chkCommonYears.setEnabled(false); chkExcludeSeriesWithNoEvents.setEnabled(false); segmentationPanel.chkSegmentation.setEnabled(false); simulationsTable.setEnabled(false); btnCancelAnalysis.setVisible(true); SSIZAnalysisModel analysisModel = createSSIZAnalysisModel(); (task = new DrawSSIZAnalysisTask(analysisModel)).execute(); validate(); repaint(); }
From source file:ExText.java
/** * Respond to a button1 event (press, release, or drag). * /*ww w .j a v a2 s.c om*/ * @param mouseEvent * A MouseEvent to respond to. */ public void onButton1(MouseEvent mev) { if (subjectTransformGroup == null) return; int x = mev.getX(); int y = mev.getY(); if (mev.getID() == MouseEvent.MOUSE_PRESSED) { // Mouse button pressed: record position previousX = x; previousY = y; // Change to a "move" cursor if (parentComponent != null) { savedCursor = parentComponent.getCursor(); parentComponent.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); } return; } if (mev.getID() == MouseEvent.MOUSE_RELEASED) { // Mouse button released: do nothing // Switch the cursor back if (parentComponent != null) parentComponent.setCursor(savedCursor); return; } // // Mouse moved while button down: create a rotation // // Compute the delta in X and Y from the previous // position. Use the delta to compute rotation // angles with the mapping: // // positive X mouse delta --> positive Y-axis rotation // positive Y mouse delta --> positive X-axis rotation // // where positive X mouse movement is to the right, and // positive Y mouse movement is **down** the screen. // int deltaX = x - previousX; int deltaY = y - previousY; if (deltaX > UNUSUAL_XDELTA || deltaX < -UNUSUAL_XDELTA || deltaY > UNUSUAL_YDELTA || deltaY < -UNUSUAL_YDELTA) { // Deltas are too huge to be believable. Probably a glitch. // Don't record the new XY location, or do anything. return; } double xRotationAngle = deltaY * XRotationFactor; double yRotationAngle = deltaX * YRotationFactor; // // Build transforms // transform1.rotX(xRotationAngle); transform2.rotY(yRotationAngle); // Get and save the current transform matrix subjectTransformGroup.getTransform(currentTransform); currentTransform.get(matrix); translate.set(matrix.m03, matrix.m13, matrix.m23); // Translate to the origin, rotate, then translate back currentTransform.setTranslation(origin); currentTransform.mul(transform1, currentTransform); currentTransform.mul(transform2, currentTransform); currentTransform.setTranslation(translate); // Update the transform group subjectTransformGroup.setTransform(currentTransform); previousX = x; previousY = y; }
From source file:com.smanempat.view.ViewClassification.java
private void buttonProsesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonProsesActionPerformed // TODO add your handling code here: if (jCheckBox1.isSelected()) { prosesManual();// w w w . j av a2s .co m } else { ControllerClassification controllerClassification = new ControllerClassification(); this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); controllerClassification.processMining(txtNumberOfK, tablePreview, labelPesanError, tableResult, labelSiswaIPA, labelSiswaIPS, labelKeterangan, jYearChooser1, jYearChooser2, jTabbedPane1); this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } buttonSimpan.setEnabled(true); buttonReClass.setEnabled(true); jPanel5.setVisible(true); // jTabbedPane1.setSelectedIndex(1); }
From source file:it.cnr.icar.eric.client.ui.swing.RegistryBrowser.java
/** * Helper method to let browser subcomponents set a wait cursor while * performing long operations./*from w ww . j ava 2 s .com*/ */ public static void setWaitCursor() { instance.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); }
From source file:it.cnr.icar.eric.client.ui.swing.RegistryBrowser.java
/** * Helper method for browser subcomponents to set the cursor back to its * default version.//from w w w . j a v a2 s . c om */ public static void setDefaultCursor() { instance.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }