Java Code Examples for java.awt.Cursor#getPredefinedCursor()
The following examples show how to use
java.awt.Cursor#getPredefinedCursor() .
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: Utilities.java From netbeans with Apache License 2.0 | 7 votes |
public static Cursor createCustomCursor(Component component, Image icon, String name) { Toolkit t = component.getToolkit(); Dimension d = t.getBestCursorSize(16, 16); Image i = icon; if (d.width != icon.getWidth(null)) { if (((d.width) == 0) && (d.height == 0)) { // system doesn't support custom cursors, falling back return Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR); } // need to resize the icon Image empty = ImageUtilities.createBufferedImage(d.width, d.height); i = ImageUtilities.mergeImages(icon, empty, 0, 0); } return t.createCustomCursor(i, new Point(1, 1), name); }
Example 2
Source File: Geometrics.java From cncgcodecontroller with MIT License | 6 votes |
/** * Returns the proper Cursor for the given area! * @param area * @return */ public static Cursor getCursor(EArea area){ switch(area){ case CENTER: return Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR); case RIGHT_SIDE: return Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR); case LEFT_SIDE: return Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR); case UPPER_SIDE: return Cursor.getPredefinedCursor(Cursor.N_RESIZE_CURSOR); case LOWER_SIDE: return Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR); case LL_CORNER: return Cursor.getPredefinedCursor(Cursor.SW_RESIZE_CURSOR); case LR_CORNER: return Cursor.getPredefinedCursor(Cursor.SE_RESIZE_CURSOR); case UL_CORNER: return Cursor.getPredefinedCursor(Cursor.NW_RESIZE_CURSOR); case UR_CORNER: return Cursor.getPredefinedCursor(Cursor.NE_RESIZE_CURSOR); default: return Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR); } }
Example 3
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 4
Source File: Cropper.java From Cognizant-Intelligent-Test-Scripter with Apache License 2.0 | 5 votes |
private void init() { normal = Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR); crop = getCropCursor(); start = new Point(0, 0); end = new Point(0, 0); click = new Point(0, 0); offsetMark = new Point(0, 0); offset = new Point(0, 0); setLayout(null); this.setIgnoreRepaint(true); editor = new CropPanel(this); add(editor); }
Example 5
Source File: InsertPlacemarkInteractor.java From snap-desktop with GNU General Public License v3.0 | 5 votes |
private Cursor createCursor() { final Image cursorImage = placemarkDescriptor.getCursorImage(); if (cursorImage == null) { return Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR); } return Toolkit.getDefaultToolkit().createCustomCursor(cursorImage, placemarkDescriptor.getCursorHotSpot(), placemarkDescriptor.getRoleName()); }
Example 6
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 7
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 8
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 9
Source File: GUIUtils.java From osp with GNU General Public License v3.0 | 5 votes |
/** * Creates a custom cursor from an image. If an exception occurs, a predefined cursor is returned. * * @param image the Image * @param hotspot the position of the cursor hotspot * @param name the name of the cursor * @param predefinedCursorType one of the predefined Cursor types */ public static Cursor createCustomCursor(Image image, Point hotspot, String name, int predefinedCursorType) { try { return Toolkit.getDefaultToolkit().createCustomCursor(image, hotspot, name); } catch (Exception ex) { try { return Cursor.getPredefinedCursor(predefinedCursorType); } catch (Exception ex1) { } } return Cursor.getPredefinedCursor(Cursor.HAND_CURSOR); }
Example 10
Source File: HyperlinkOperation.java From netbeans with Apache License 2.0 | 5 votes |
private static synchronized Cursor getMouseCursor(HyperlinkType type) { switch (type) { case GO_TO_DECLARATION: case ALT_HYPERLINK: return Cursor.getPredefinedCursor(Cursor.HAND_CURSOR); default: throw new UnsupportedOperationException(); } }
Example 11
Source File: ImageManager.java From dsworkbench with Apache License 2.0 | 5 votes |
public static Cursor createVillageDragCursor(int pVillageCount) { try { Image i = ImageIO.read(new File("graphics/cursors/village_drag.png")); i.getGraphics().setColor(Color.BLACK); i.getGraphics().drawString(Integer.toString(pVillageCount), 5, 12); return Toolkit.getDefaultToolkit().createCustomCursor(i, new Point(0, 0), "Village"); } catch (Exception ignored) { } return Cursor.getPredefinedCursor(Cursor.HAND_CURSOR); }
Example 12
Source File: DragManager.java From netbeans with Apache License 2.0 | 4 votes |
public Cursor getCursor() { return Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR); }
Example 13
Source File: HyperlinkOperation.java From netbeans with Apache License 2.0 | 4 votes |
private static synchronized boolean isHyperlinkMouseCursor(Cursor c) { return c == Cursor.getPredefinedCursor(Cursor.HAND_CURSOR) || c == Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR) || c == Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR); }
Example 14
Source File: FlashingIcon.java From netbeans with Apache License 2.0 | 4 votes |
@Override public Cursor getCursor() { return Cursor.getPredefinedCursor(Cursor.HAND_CURSOR); }
Example 15
Source File: SelectTool.java From Logisim with GNU General Public License v3.0 | 4 votes |
@Override public Cursor getCursor(Canvas canvas) { return Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR); }
Example 16
Source File: RectangularTool.java From Logisim with GNU General Public License v3.0 | 4 votes |
@Override public Cursor getCursor(Canvas canvas) { return Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR); }
Example 17
Source File: GoGui.java From FancyBing with GNU General Public License v3.0 | 4 votes |
private void setCursor(Component component, int type) { Cursor cursor = Cursor.getPredefinedCursor(type); component.setCursor(cursor); }
Example 18
Source File: VisualGraphZoomingPickingGraphMousePlugin.java From ghidra with Apache License 2.0 | 4 votes |
public VisualGraphZoomingPickingGraphMousePlugin() { super(InputEvent.BUTTON1_MASK); this.cursor = Cursor.getPredefinedCursor(Cursor.HAND_CURSOR); }
Example 19
Source File: TextTool.java From Logisim with GNU General Public License v3.0 | 4 votes |
@Override public Cursor getCursor(Canvas canvas) { return Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR); }
Example 20
Source File: VisualGraphTranslatingGraphMousePlugin.java From ghidra with Apache License 2.0 | 4 votes |
public VisualGraphTranslatingGraphMousePlugin(int modifiers) { super(modifiers); this.cursor = Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR); }