Java Code Examples for javafx.scene.Scene#getCursor()

The following examples show how to use javafx.scene.Scene#getCursor() . 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: FloodFill2D.java    From paintera with GNU General Public License v2.0 5 votes vote down vote up
public void fillAt(final double x, final double y, final long fill)
{
	if (!isVisible.getAsBoolean())
	{
		LOG.info("Selected source is not visible -- will not fill");
		return;
	}

	final int level = 0;
	final int time = 0;
	final MaskInfo<UnsignedLongType> maskInfo = new MaskInfo<>(time, level, new UnsignedLongType(fill));

	final Scene  scene          = viewer.getScene();
	final Cursor previousCursor = scene.getCursor();
	scene.setCursor(Cursor.WAIT);
	try
	{
		final Mask<UnsignedLongType> mask = source.generateMask(maskInfo, FOREGROUND_CHECK);
		final Interval affectedInterval = fillMaskAt(x, y, this.viewer, mask, source, assignment, FILL_VALUE, this.fillDepth.get());
		requestRepaint.run();
		source.applyMask(mask, affectedInterval, FOREGROUND_CHECK);
	} catch (final MaskInUse e)
	{
		LOG.debug(e.getMessage());
	} finally
	{
		scene.setCursor(previousCursor);
	}
}
 
Example 2
Source File: Text.java    From CircuitSim with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void mouseEntered(CircuitManager manager, CircuitState state) {
	Scene scene = manager.getSimulatorWindow().getScene();
	prevCursor = scene.getCursor();
	scene.setCursor(Cursor.TEXT);
	
	entered = true;
}
 
Example 3
Source File: CursorSupport.java    From gef with Eclipse Public License 2.0 3 votes vote down vote up
/**
 * Sets the given {@link Cursor} as the mouse cursor for the {@link Scene}
 * of the host visual. Note that this method does not store the original
 * mouse cursor.
 *
 * @param cursor
 *            The new mouse {@link Cursor}.
 * @see #storeAndReplaceCursor(Cursor)
 * @see #restoreCursor()
 */
public void setCursor(Cursor cursor) {
	Scene scene = getAdaptable().getRootPart().getVisual().getScene();
	if (cursor != scene.getCursor()) {
		scene.setCursor(cursor);
	}
}