List of usage examples for java.awt Cursor getDefaultCursor
public static Cursor getDefaultCursor()
From source file:com.ivli.roim.controls.ChartControl.java
void dropSelection() { iEntity = null; iSeries = null; iDataItem = null; iMarker = null; setCursor(Cursor.getDefaultCursor()); }
From source file:de._13ducks.cor.graphics.GraphicsComponent.java
public void setCursor(boolean rcursor) { renderCursor = rcursor;//from w w w. j a v a 2 s .c o m if (rcursor) { int[] pixels = new int[16 * 16]; Image image = Toolkit.getDefaultToolkit().createImage(new MemoryImageSource(16, 16, pixels, 0, 16)); Cursor transparentCursor = Toolkit.getDefaultToolkit().createCustomCursor(image, new Point(0, 0), "invisibleCursor"); this.setCursor(transparentCursor); } else { this.setCursor(Cursor.getDefaultCursor()); } }
From source file:AltiConsole.AltiConsoleMainScreen.java
public boolean RetrievingFlight() { this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); listData = null;//from www. ja v a 2 s . c o m listData = new DefaultListModel(); if (Serial.getConnected() == false) { boolean ret = false; ret = ConnectToAlti(); if (!ret) { System.out.println("Data retrieval timed out1\n"); JOptionPane.showMessageDialog(null, trans.get("AltiConsoleMainScreen.dataTimeOut"), trans.get("AltiConsoleMainScreen.ConnectionError"), JOptionPane.ERROR_MESSAGE); this.setCursor(Cursor.getDefaultCursor()); return false; } } // check the connection //Serial.DataReady = false; Serial.setDataReady(false); Serial.writeData("h;\n"); long startTime; // = System.currentTimeMillis(); Serial.lastReceived = System.currentTimeMillis(); while (!Serial.getDataReady()) { long currentTime = System.currentTimeMillis(); startTime = Serial.lastReceived; if ((currentTime - startTime) > 130000) { // This is some sort of data retrieval timeout System.out.println("Data retrieval timed out2 flight\n"); JOptionPane.showMessageDialog(null, trans.get("AltiConsoleMainScreen.dataTimeOut"), trans.get("AltiConsoleMainScreen.ConnectionError"), JOptionPane.ERROR_MESSAGE); this.setCursor(Cursor.getDefaultCursor()); return false; } } Serial.initFlightData(UserPref.getAppUnits()); // get the flight data //Serial.DataReady = false; Serial.setDataReady(false); Serial.writeData("a;\n"); Serial.lastReceived = System.currentTimeMillis(); while (!Serial.getDataReady()) { long currentTime = System.currentTimeMillis(); startTime = Serial.lastReceived; if ((currentTime - startTime) > 130000) { // This is some sort of data retrieval timeout System.out.println("Data retrieval timed out3\n"); JOptionPane.showMessageDialog(null, trans.get("AltiConsoleMainScreen.dataTimeOut"), trans.get("AltiConsoleMainScreen.ConnectionError"), JOptionPane.ERROR_MESSAGE); this.setCursor(Cursor.getDefaultCursor()); return false; } } System.out.println("done retrieving flight\n"); List<String> AllFlightNames2; AllFlightNames2 = Serial.MyFlight.getAllFlightNames2(); for (String z : AllFlightNames2) { listData.addElement(z); } flightList.setModel(listData); flightList.setAutoCreateRowSorter(true); flightList.toggleSortOrder(); flightList.setSortOrder(SortOrder.ASCENDING); flightList.clearSelection(); flightList.setSelectedIndex(0); if (Serial.MyFlight.FlightExist("Flight 1")) { plot.setDataset(0, Serial.MyFlight.GetFlightData("Flight 1")); } this.setCursor(Cursor.getDefaultCursor()); return true; }
From source file:com.rapidminer.gui.new_plotter.engine.jfreechart.link_and_brush.LinkAndBrushChartPanel.java
@Override public void mouseReleased(MouseEvent e) { // if we've been panning, we need to reset now that the mouse is // released... Rectangle2D zoomRectangle = (Rectangle2D) getChartFieldValueByName("zoomRectangle"); Point2D zoomPoint = (Point2D) getChartFieldValueByName("zoomPoint"); if (getChartFieldValueByName("panLast") != null) { setChartFieldValue((getChartFieldByName("panLast")), null); setCursor(Cursor.getDefaultCursor()); } else if (zoomRectangle != null) { boolean hZoom = false; boolean vZoom = false; if ((PlotOrientation) getChartFieldValueByName("orientation") == PlotOrientation.HORIZONTAL) { hZoom = (Boolean) getChartFieldValueByName("rangeZoomable"); vZoom = (Boolean) getChartFieldValueByName("domainZoomable"); } else {//from w ww . j av a2 s . co m hZoom = (Boolean) getChartFieldValueByName("domainZoomable"); vZoom = (Boolean) getChartFieldValueByName("rangeZoomable"); } boolean zoomTrigger1 = hZoom && Math .abs(e.getX() - zoomPoint.getX()) >= (Integer) getChartFieldValueByName("zoomTriggerDistance"); boolean zoomTrigger2 = vZoom && Math .abs(e.getY() - zoomPoint.getY()) >= (Integer) getChartFieldValueByName("zoomTriggerDistance"); if (zoomTrigger1 || zoomTrigger2) { if ((hZoom && (e.getX() < zoomPoint.getX())) || (vZoom && (e.getY() < zoomPoint.getY()))) { restoreAutoBounds(); } else { double x, y, w, h; Rectangle2D screenDataArea = getScreenDataArea((int) zoomPoint.getX(), (int) zoomPoint.getY()); double maxX = screenDataArea.getMaxX(); double maxY = screenDataArea.getMaxY(); // for mouseReleased event, (horizontalZoom || verticalZoom) // will be true, so we can just test for either being false; // otherwise both are true if (!vZoom) { x = zoomPoint.getX(); y = screenDataArea.getMinY(); w = Math.min(zoomRectangle.getWidth(), maxX - zoomPoint.getX()); h = screenDataArea.getHeight(); } else if (!hZoom) { x = screenDataArea.getMinX(); y = zoomPoint.getY(); w = screenDataArea.getWidth(); h = Math.min(zoomRectangle.getHeight(), maxY - zoomPoint.getY()); } else { x = zoomPoint.getX(); y = zoomPoint.getY(); w = Math.min(zoomRectangle.getWidth(), maxX - zoomPoint.getX()); h = Math.min(zoomRectangle.getHeight(), maxY - zoomPoint.getY()); } Rectangle2D zoomArea = new Rectangle2D.Double(x, y, w, h); zoom(zoomArea); } setChartFieldValue(getChartFieldByName("zoomPoint"), null); setChartFieldValue(getChartFieldByName("zoomRectangle"), null); } else { // erase the zoom rectangle Graphics2D g2 = (Graphics2D) getGraphics(); if ((Boolean) getChartFieldValueByName("useBuffer")) { repaint(); } else { drawZoomRectangle(g2, true); } g2.dispose(); setChartFieldValue(getChartFieldByName("zoomPoint"), null); setChartFieldValue(getChartFieldByName("zoomRectangle"), null); } } else if (e.isPopupTrigger()) { if (getChartFieldValueByName("popup") != null) { displayPopupMenu(e.getX(), e.getY()); } } }
From source file:biz.wolschon.finance.jgnucash.JGnucash.java
/** * Show the file->save as... -dialog. *///from w ww . j a va 2 s. co m private void saveFileAs() { int state = getJFileChooser().showSaveDialog(this); if (state == JFileChooser.APPROVE_OPTION) { File f = getJFileChooser().getSelectedFile(); try { setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); getWritableModel().writeFile(f); saveFile(); setTitle(f.getName()); } catch (FileNotFoundException e) { LOGGER.error("cannot save file '" + f.getAbsolutePath() + "' (file not found)", e); JOptionPane.showMessageDialog(this, "Error", "cannot save file '" + f.getAbsolutePath() + "' (file not found)", JOptionPane.ERROR_MESSAGE); } catch (IOException e) { LOGGER.error("cannot save file '" + f.getAbsolutePath() + "' (io-problem)", e); JOptionPane.showMessageDialog(this, "Error", "cannot save file '" + f.getAbsolutePath() + "' (io-problem)", JOptionPane.ERROR_MESSAGE); } catch (JAXBException e) { LOGGER.error("cannot save file '" + f.getAbsolutePath() + "' (gnucash-format-problem)", e); JOptionPane.showMessageDialog(this, "Error", "cannot save file '" + f.getAbsolutePath() + "' (gnucash-format-problem)", JOptionPane.ERROR_MESSAGE); } finally { setCursor(Cursor.getDefaultCursor()); } } }
From source file:de.juwimm.cms.Main.java
public void actionPerformed(ActionEvent e) { String action = e.getActionCommand(); this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); try {/* w ww .j a v a2s. c o m*/ if (action.equals(Constants.ACTION_EXIT)) { if (ActionHub.fireExitPerformed(new ExitEvent())) { comm.getDbHelper().shutdown(); System.exit(0); } } else if (action.equals(Constants.ACTION_LOGIN)) { this.setLayout(new BorderLayout()); Constants.CMS_CLIENT_VIEW = -1; setCenterPanel(PanInitView.getInstance()); if (panStatusbar == null) { panStatusbar = new PanStatusbar(); UIConstants.setStatusLine(panStatusbar); ActionHub.addActionListener(panStatusbar); } if (panRibbon == null) { panRibbon = new PanRibbon(comm); ActionHub.addActionListener(panRibbon); } this.getContentPane().add(panRibbon, BorderLayout.NORTH); ActionHub.fireActionPerformed( new ActionEvent(this, ActionEvent.ACTION_PERFORMED, Constants.ACTION_VIEW_EDITOR)); // this.getJMenuBar().setVisible(true); // this.getContentPane().add(panToolbar, BorderLayout.NORTH); this.getContentPane().add(panStatusbar, BorderLayout.SOUTH); this.getRootPane().setDoubleBuffered(true); this.getRootPane().validate(); this.getRootPane().repaint(); } else if (action.equals(Constants.ACTION_LOGOFF)) { if (ActionHub.fireExitPerformed(new ExitEvent())) { comm.setLoggedIn(false); Application.initializeContext(); panLogin = new PanLogin(); panRoot = null; panAdmin = null; panRibbon = null; this.getContentPane().removeAll(); //this.getJMenuBar().setVisible(false); comm.getDbHelper().autoEmptyCache(); PanContentView.getInstance().unloadAll(); setCenterPanel(panLogin); Constants.CMS_CLIENT_VIEW = Constants.CLIENT_VIEW_LOGIN; this.validate(); this.getContentPane().validate(); this.getContentPane().repaint(); this.repaint(); panLogin.init(); } } else if (action.equals(Constants.ACTION_VIEW_EDITOR)) { showToolPanel(false, e); panTool = PanTool.getInstance(); Constants.CMS_CLIENT_VIEW = Constants.CLIENT_VIEW_CONTENT; } else if (action.equals(Constants.ACTION_VIEW_EDITOR_WITH_SELECTION)) { showToolPanel(true, e); panTool = PanTool.getInstance(); Constants.CMS_CLIENT_VIEW = Constants.CLIENT_VIEW_CONTENT; } else if (action.equals(Constants.ACTION_VIEW_ADMIN) || action.equals(Constants.ACTION_VIEW_ROOT)) { Constants.CMS_CLIENT_VIEW = Constants.CLIENT_VIEW_ADMIN; showAdminPanel(); panStatusbar.setCountVisible(false); } else if (action.equals(Constants.ACTION_CHANGE_PASSWORD)) { showChangePasswordDialog(); } else if (action.equals(Constants.ACTION_SHOW_TASK)) { showTaskPanel(); panStatusbar.setCountVisible(false); Constants.CMS_CLIENT_VIEW = Constants.CLIENT_VIEW_TASK; } else if (action.equals(Constants.ACTION_SHOW_CONTENT)) { Constants.CMS_CLIENT_VIEW = Constants.CLIENT_VIEW_CONTENT; } } catch (Exception exe) { log.error("Error in actionPerformed", exe); } finally { this.setCursor(Cursor.getDefaultCursor()); } }
From source file:net.schweerelos.parrot.ui.GraphViewComponent.java
@Override public void setModel(ParrotModel model) { removeAll();//w w w . ja va 2 s . c o m if (model == null) { maybeSaveLayout(); layout = null; vv.setGraphLayout(null); return; } if (!(model instanceof GraphParrotModel)) { throw new IllegalArgumentException("model must be a graph model"); } this.model = model; graph = ((GraphParrotModel) model).asGraph(); popup = new NodeWrapperPopupMenu(SwingUtilities.getRoot(this), model); model.addParrotModelListener(new ParrotModelListener() { @Override public void highlightsChanged() { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { vv.fireStateChanged(); vv.repaint(); } }); } @Override public void restrictionsChanged(final Collection<NodeWrapper> currentlyHidden) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { includePredicate.setCurrentlyHidden(currentlyHidden); vv.repaint(); } }); } @Override public void modelBusy() { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { synchronized (GraphViewComponent.this.model) { if (!GraphViewComponent.this.model.isBusy()) { return; } vv.setEnabled(false); view.setEnabled(false); GraphViewComponent.this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); view.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); vv.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); } } }); } @Override public void modelIdle() { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { synchronized (GraphViewComponent.this.model) { if (GraphViewComponent.this.model.isBusy()) { return; } view.setEnabled(true); vv.setEnabled(true); GraphViewComponent.this.setCursor(Cursor.getDefaultCursor()); view.setCursor(Cursor.getDefaultCursor()); vv.setCursor(Cursor.getDefaultCursor()); } } }); } }); layout = new NodeWrapperPersistentLayoutImpl(new KKLayout<NodeWrapper, NodeWrapper>(graph)); layout.setSize(new Dimension(880, 600)); String layoutFilename = getLayoutFilename(); try { if (new File(layoutFilename).canRead()) { ((PersistentLayout<NodeWrapper, NodeWrapper>) layout).restore(layoutFilename); } } catch (IOException e) { // TODO #1 Auto-generated catch block e.printStackTrace(); } catch (ClassNotFoundException e) { // TODO #1 Auto-generated catch block e.printStackTrace(); } vv.setGraphLayout(layout); GraphZoomScrollPane pane = new GraphZoomScrollPane(vv); ModeToggle modeToggle = new ModeToggle(mouse); pane.setCorner(modeToggle); add(pane, CONTENT_CONSTRAINTS); view = pane; }
From source file:net.sf.firemox.clickable.target.card.VirtualCard.java
public void mouseReleased(MouseEvent e) { card.setCursor(Cursor.getDefaultCursor()); card.mouseReleased(e); }
From source file:de.juwimm.cms.content.panel.PanDocuments.java
private void upload(String prosa, Integer unit, Integer viewComponentId, Integer documentId) { this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); JFileChooser fc = new JFileChooser(); int ff = fc.getChoosableFileFilters().length; FileFilter[] fft = fc.getChoosableFileFilters(); for (int i = 0; i < ff; i++) { fc.removeChoosableFileFilter(fft[i]); }//w ww. j a va2s . c om fc.addChoosableFileFilter(new DocumentFilter()); fc.setAccessory(new ImagePreview(fc)); fc.setDialogTitle(prosa); fc.setMultiSelectionEnabled(true); fc.setCurrentDirectory(Constants.LAST_LOCAL_UPLOAD_DIR); int returnVal = fc.showDialog(this, Messages.getString("panel.content.documents.addDocument")); if (returnVal == JFileChooser.APPROVE_OPTION) { File[] files = fc.getSelectedFiles(); uploadFiles(files, unit, viewComponentId, documentId); Constants.LAST_LOCAL_UPLOAD_DIR = fc.getCurrentDirectory(); } this.setCursor(Cursor.getDefaultCursor()); }
From source file:uk.ac.lkl.cram.ui.ModuleFrame.java
private JXTaskPane createLearningTypeChartPane() { JXTaskPane typeChartPane = new JXTaskPane(); typeChartPane.setTitle("Learning Types"); typeChartPane.setScrollOnExpand(true); final LearningTypeChartMaker maker = new LearningTypeChartMaker(module); final ChartPanel chartPanel = maker.getChartPanel(); //Add a mouse listener to the chart chartPanel.addChartMouseListener(new ChartMouseListener() { @Override/*w w w . j a va 2 s . com*/ public void chartMouseClicked(ChartMouseEvent cme) { //Get the mouse event MouseEvent trigger = cme.getTrigger(); //Test if the mouse event is a left-button if (trigger.getButton() == MouseEvent.BUTTON1 && trigger.getClickCount() == 2) { //Check that the mouse click is on a segment of the pie if (cme.getEntity() instanceof PieSectionEntity) { //Get the selected segment of the pie PieSectionEntity pieSection = (PieSectionEntity) cme.getEntity(); //Get the key that corresponds to that segment--this is a learning type String key = pieSection.getSectionKey().toString(); //Get the set of tlalineitems whose activity contains that learning type Set<TLALineItem> relevantTLAs = maker.getLearningTypeMap().get(key); //Create a pop up dialog containing that set of tlalineitems LearningTypePopupDialog popup = new LearningTypePopupDialog( (Frame) SwingUtilities.getWindowAncestor(chartPanel), true, relevantTLAs, key); //Set the title of the popup to indicate which learning type was selected popup.setTitle("Activities with \'" + key + "\'"); //Centre the popup at the location of the mouse click Point location = trigger.getLocationOnScreen(); int w = popup.getWidth(); int h = popup.getHeight(); popup.setLocation(location.x - w / 2, location.y - h / 2); popup.setVisible(true); int returnStatus = popup.getReturnStatus(); if (returnStatus == LearningTypePopupDialog.RET_OK) { modifyTLALineItem(popup.getSelectedTLALineItem(), 0); } } } } @Override public void chartMouseMoved(ChartMouseEvent cme) { //Set the cursor shape according to the location of the cursor if (cme.getEntity() instanceof PieSectionEntity) { chartPanel.setCursor(HAND); } else { chartPanel.setCursor(Cursor.getDefaultCursor()); } } }); chartPanel.setPreferredSize(new Dimension(150, 200)); typeChartPane.add(chartPanel); return typeChartPane; }