Java Code Examples for java.awt.Cursor#getDefaultCursor()
The following examples show how to use
java.awt.Cursor#getDefaultCursor() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SeaGlassTextFieldUI.java From seaglass with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ @Override public void mouseMoved(MouseEvent e) { currentMouseX = e.getX(); currentMouseY = e.getY(); Cursor cursorToUse = Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR); if (isOverCancelButton() || isOverFindButton()) { cursorToUse = Cursor.getDefaultCursor(); } JComponent c = (JComponent) e.getSource(); if (!cursorToUse.equals(c.getCursor())) { c.setCursor(cursorToUse); } super.mouseMoved(e); }
Example 2
Source File: BoxContainerPanelUI.java From pumpernickel with MIT License | 6 votes |
public Cursor getCursor() { switch (position) { case SwingConstants.NORTH: return Cursor.getPredefinedCursor(Cursor.N_RESIZE_CURSOR); case SwingConstants.SOUTH: return Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR); case SwingConstants.EAST: return Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR); case SwingConstants.WEST: return Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR); case SwingConstants.NORTH_EAST: return Cursor.getPredefinedCursor(Cursor.NE_RESIZE_CURSOR); case SwingConstants.SOUTH_EAST: return Cursor.getPredefinedCursor(Cursor.SE_RESIZE_CURSOR); case SwingConstants.NORTH_WEST: return Cursor.getPredefinedCursor(Cursor.NW_RESIZE_CURSOR); case SwingConstants.SOUTH_WEST: return Cursor.getPredefinedCursor(Cursor.SW_RESIZE_CURSOR); } return Cursor.getDefaultCursor(); }
Example 3
Source File: TimelinePanel.java From visualvm with GNU General Public License v2.0 | 5 votes |
private void updateCursor() { if (draggingRow != null) { Cursor resizeCursor = Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR); chart.setCursor(resizeCursor); probesPanel.setCursor(resizeCursor); } else { Cursor defaultCursor = Cursor.getDefaultCursor(); chart.setCursor(defaultCursor); probesPanel.setCursor(defaultCursor); } }
Example 4
Source File: ImageManager.java From dsworkbench with Apache License 2.0 | 5 votes |
/** * Get the cursor for the provided ID */ public static Cursor getCursor(int pID) { if (!cursorSupported) { return Cursor.getDefaultCursor(); } return CURSORS.get(pID); }
Example 5
Source File: CursorRepository.java From stendhal with GNU General Public License v2.0 | 5 votes |
private Cursor loadCursor(StendhalCursor stendhalCursor) { String imageName = "data/sprites/cursor/" + stendhalCursor.getImageName(); // load image file URL url = DataLoader.getResource(imageName); if (url == null) { logger.error("Can't find image: " + imageName, new Throwable()); cursorMap.put(stendhalCursor, Cursor.getDefaultCursor()); return Cursor.getDefaultCursor(); } // use ImageIO to read the image in Image image; try { image = ImageIO.read(url); } catch (IOException e) { logger.error("Can't read image: " + imageName, new Throwable()); cursorMap.put(stendhalCursor, Cursor.getDefaultCursor()); return Cursor.getDefaultCursor(); } // create cursor Point hotSpot = stendhalCursor.getHotSpot(); String name = stendhalCursor.toString().toLowerCase(Locale.ENGLISH); Cursor res = Toolkit.getDefaultToolkit().createCustomCursor(image, hotSpot, name); cursorMap.put(stendhalCursor, res); return res; }
Example 6
Source File: BoxContainerPanelUI.java From pumpernickel with MIT License | 5 votes |
@Override public void mouseMoved(MouseEvent e) { Cursor cursor = getCursor(e); if (cursor == null) { cursor = Cursor.getDefaultCursor(); } bcp.setCursor(cursor); bcp.putClientProperty(KEY_TARGET_HANDLE_OPACITY, 1f); }
Example 7
Source File: FlashingIcon.java From visualvm with GNU General Public License v2.0 | 5 votes |
@Override public Cursor getCursor() { if( isIconVisible ) { return Cursor.getPredefinedCursor( Cursor.HAND_CURSOR ); } return Cursor.getDefaultCursor(); }
Example 8
Source File: Outline.java From gcs with Mozilla Public License 2.0 | 5 votes |
@Override public void mouseMoved(MouseEvent event) { if (isEnabled()) { Row rollRow = null; try { boolean local = event.getSource() == this; int x = event.getX(); int y = event.getY(); Row rowHit; Column column; Cursor cursor = Cursor.getDefaultCursor(); if (overColumnDivider(x) != null) { if (allowColumnResize()) { cursor = Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR); } } else if (local) { column = overColumn(x); if (column != null) { rowHit = overRow(y); if (rowHit != null) { if (overDisclosureControl(x, y, column, rowHit)) { rollRow = rowHit; } else { Cell cell = column.getRowCell(rowHit); cursor = cell.getCursor(event, getCellBounds(rowHit, column), rowHit, column); } } } } setCursor(cursor); } finally { repaintChangedRollRow(rollRow); } } }
Example 9
Source File: OutlineHeader.java From gcs with Mozilla Public License 2.0 | 5 votes |
@Override public void mouseMoved(MouseEvent event) { Cursor cursor = Cursor.getDefaultCursor(); int x = event.getX(); if (mOwner.overColumnDivider(x) != null) { if (mOwner.allowColumnResize()) { cursor = Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR); } } else if (mOwner.overColumn(x) != null) { cursor = Cursor.getPredefinedCursor(Cursor.HAND_CURSOR); } setCursor(cursor); }
Example 10
Source File: TimelinePanel.java From netbeans with Apache License 2.0 | 5 votes |
private void updateCursor() { if (draggingRow != null) { Cursor resizeCursor = Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR); chart.setCursor(resizeCursor); probesPanel.setCursor(resizeCursor); } else { Cursor defaultCursor = Cursor.getDefaultCursor(); chart.setCursor(defaultCursor); probesPanel.setCursor(defaultCursor); } }
Example 11
Source File: FlashingIcon.java From netbeans with Apache License 2.0 | 5 votes |
@Override public Cursor getCursor() { if( isIconVisible ) { return Cursor.getPredefinedCursor( Cursor.HAND_CURSOR ); } return Cursor.getDefaultCursor(); }
Example 12
Source File: TextCell.java From gcs with Mozilla Public License 2.0 | 4 votes |
@Override public Cursor getCursor(MouseEvent event, Rectangle bounds, Row row, Column column) { return Cursor.getDefaultCursor(); }
Example 13
Source File: IconsCell.java From gcs with Mozilla Public License 2.0 | 4 votes |
@Override public Cursor getCursor(MouseEvent event, Rectangle bounds, Row row, Column column) { return Cursor.getDefaultCursor(); }
Example 14
Source File: WeaponDescriptionCell.java From gcs with Mozilla Public License 2.0 | 4 votes |
@Override public Cursor getCursor(MouseEvent event, Rectangle bounds, Row row, Column column) { return Cursor.getDefaultCursor(); }
Example 15
Source File: GlassPane.java From netbeans with Apache License 2.0 | 4 votes |
/** * Updates cursor according to its location. For example, it sets * the appropriate resizing cursor when the mouse is over the boundary * of the selection component. * * @param cursorLocation current mouse cursor location. */ void updateCursor(Point cursorLocation) { Cursor cursor = Cursor.getDefaultCursor(); if (cursorLocation == null) { resizingMode = 0; } else { int x = cursorLocation.x; int y = cursorLocation.y; Image resizeHandle = GridDesigner.RESIZE_HANDLE; int rw = resizeHandle.getWidth(null); int rh = resizeHandle.getHeight(null); for (Component selComp : selection) { Rectangle rect = fromComponentPane(selectionResizingBounds(selComp)); boolean w = (rect.x-rw<=x) && (x<=rect.x+rect.width+rw); boolean h = (rect.y-rh<=y) && (y<=rect.y+rect.height+rh); boolean top = w && (rect.y-rh<=y) && (y<=rect.y+2); boolean bottom = w && (rect.y+rect.height-2<=y) && (y<=rect.y+rect.height+rh); boolean left = h && (rect.x-rw<=x) && (x<=rect.x+2); boolean right = h && (rect.x+rect.width-2<=x) && (x<=rect.x+rect.width+rw); if (top) { if (left) { cursor = Cursor.getPredefinedCursor(Cursor.NW_RESIZE_CURSOR); resizingMode = SwingConstants.NORTH_WEST; } else if (right) { cursor = Cursor.getPredefinedCursor(Cursor.NE_RESIZE_CURSOR); resizingMode = SwingConstants.NORTH_EAST; } else { cursor = Cursor.getPredefinedCursor(Cursor.N_RESIZE_CURSOR); resizingMode = SwingConstants.NORTH; } } else if (bottom) { if (left) { cursor = Cursor.getPredefinedCursor(Cursor.SW_RESIZE_CURSOR); resizingMode = SwingConstants.SOUTH_WEST; } else if (right) { cursor = Cursor.getPredefinedCursor(Cursor.SE_RESIZE_CURSOR); resizingMode = SwingConstants.SOUTH_EAST; } else { cursor = Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR); resizingMode = SwingConstants.SOUTH; } } else if (left) { cursor = Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR); resizingMode = SwingConstants.WEST; } else if (right) { cursor = Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR); resizingMode = SwingConstants.EAST; } else { cursor = Cursor.getDefaultCursor(); resizingMode = 0; } if (resizingMode != 0) { focusedComponent = selComp; break; } } } setCursor(cursor); }
Example 16
Source File: ConcordiaGraphPanel.java From ET_Redux with Apache License 2.0 | 4 votes |
/** * Creates a new instance of ConcordiaGraphPanel * * @param mySample * @param reportUpdater the value of reportUpdater */ public ConcordiaGraphPanel(SampleInterface mySample, ReportUpdaterInterface reportUpdater) { super(); this.sample = mySample; this.reportUpdater = reportUpdater; setOpaque(true); setBackground(Color.white); selectedFractions = new Vector<>(); excludedFractions = new Vector<>(); this.showConcordiaErrorBars = true; this.showEllipseCenters = true; this.showEllipseLabels = true; this.showExcludedEllipses = true; this.showFilteredEllipses = false; this.display_r206_238r_Th = false; this.display_r206_238r_Pa = false; this.display_PbcCorr = false; this.yorkLineFit = null; concordiaCursor = Cursor.getDefaultCursor(); this.imageMode = "PAN"; this.showTitleBox = true; // set up title box concordiaTitlePanel = new TitleBoxPanel(sample.getSampleName()); this.savedConcordiaTitlePanelX = concordiaTitlePanel.getX(); this.savedConcordiaTitlePanelY = concordiaTitlePanel.getY(); this.heatMapLegendPanel = new HeatMapLegendPanel("legend"); this.useUncertaintyCrosses = false; changingBestDateDivider = false; try { lambda235 = sample.getPhysicalConstantsModel().getDatumByName(Lambdas.lambda235.getName()); lambda238 = sample.getPhysicalConstantsModel().getDatumByName(Lambdas.lambda238.getName()); lambda232 = sample.getPhysicalConstantsModel().getDatumByName(Lambdas.lambda232.getName()); } catch (BadLabDataException ex) { new ETWarningDialog(ex).setVisible(true); } setViewOptions(); this.fadedDeselectedFractions = false; // default is standard Concordia this.concordiaFlavor = "C"; addMouseListener(this); addMouseMotionListener(this); // addMouseWheelListener(this); }
Example 17
Source File: WrappedCell.java From gcs with Mozilla Public License 2.0 | 4 votes |
@Override public Cursor getCursor(MouseEvent event, Rectangle bounds, Row row, Column column) { return Cursor.getDefaultCursor(); }
Example 18
Source File: MultiCell.java From gcs with Mozilla Public License 2.0 | 4 votes |
@Override public Cursor getCursor(MouseEvent event, Rectangle bounds, Row row, Column column) { return Cursor.getDefaultCursor(); }
Example 19
Source File: AbstractPlot.java From ET_Redux with Apache License 2.0 | 4 votes |
/** * Specifies a new abstract Plot * * @param mySample * @param reportUpdater the value of reportUpdater */ public AbstractPlot(SampleInterface mySample, ReportUpdaterInterface reportUpdater) { super(); this.sample = mySample; this.reportUpdater = reportUpdater; selectedFractions = new Vector<>(); excludedFractions = new Vector<>(); this.showEllipseCenters = true; this.showEllipseLabels = true; this.showExcludedEllipses = true; this.showFilteredEllipses = false; this.yorkLineFit = null; concordiaCursor = Cursor.getDefaultCursor(); this.imageMode = "PAN"; this.showTitleBox = true; // set up title box concordiaTitlePanel = new TitleBoxPanel(sample.getSampleName()); this.savedConcordiaTitlePanelX = concordiaTitlePanel.getX(); this.savedConcordiaTitlePanelY = concordiaTitlePanel.getY(); this.heatMapLegendPanel = new HeatMapLegendPanel("legend"); this.useUncertaintyCrosses = false; setViewOptions(); this.fadedDeselectedFractions = false; // default is standard Concordia this.concordiaFlavor = "C"; this.showEquiline = true; this.showRegressionLine = true; this.showRegressionLineUnct = false; this.showIsochrons = true; }
Example 20
Source File: HeadedUiContext.java From triplea with GNU General Public License v3.0 | 4 votes |
@Override protected void internalSetMapDir(final String dir, final GameData data) { if (resourceLoader != null) { resourceLoader.close(); } resourceLoader = ResourceLoader.getMapResourceLoader(dir); mapData = new MapData(dir); // DiceImageFactory needs loader and game data diceImageFactory = new DiceImageFactory(resourceLoader, data.getDiceSides()); final double unitScale = getPreferencesMapOrSkin(dir).getDouble(UNIT_SCALE_PREF, mapData.getDefaultUnitScale()); scale = getPreferencesMapOrSkin(dir).getDouble(MAP_SCALE_PREF, 1); unitImageFactory = new UnitImageFactory(resourceLoader, unitScale, mapData); // TODO: separate scale for resources resourceImageFactory.setResourceLoader(resourceLoader); territoryEffectImageFactory.setResourceLoader(resourceLoader); unitIconImageFactory.setResourceLoader(resourceLoader); flagIconImageFactory.setResourceLoader(resourceLoader); puImageFactory.setResourceLoader(resourceLoader); tileImageFactory.setMapDir(resourceLoader); // load map data mapImage.loadMaps(resourceLoader); mapDir = dir; drawTerritoryEffects = mapData.useTerritoryEffectMarkers(); // load the sounds in a background thread, // avoids the pause where sounds dont load right away // change the resource loader (this allows us to play sounds the map folder, rather than just // default sounds) new Thread(() -> ClipPlayer.getInstance(resourceLoader), "TripleA sound loader").start(); // load a new cursor cursor = Cursor.getDefaultCursor(); final Toolkit toolkit = Toolkit.getDefaultToolkit(); // URL's use "/" not "\" final URL cursorUrl = resourceLoader.getResource("misc/cursor.gif"); if (cursorUrl != null) { try { final Image image = ImageIO.read(cursorUrl); if (image != null) { final Point hotSpot = new Point(mapData.getMapCursorHotspotX(), mapData.getMapCursorHotspotY()); cursor = toolkit.createCustomCursor(image, hotSpot, data.getGameName() + " Cursor"); } } catch (final Exception e) { log.log(Level.SEVERE, "Failed to create cursor from: " + cursorUrl, e); } } }