Java Code Examples for java.awt.Component#getCursor()

The following examples show how to use java.awt.Component#getCursor() . These examples are extracted from open source projects. 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
private void updateCursorImpl() {
    final Point cursorPos = getCursorPosition();
    final Component c = findComponent(cursorPos);
    final Cursor cursor;
    final Object peer = LWToolkit.targetToPeer(c);
    if (peer instanceof LWComponentPeer) {
        final LWComponentPeer<?, ?> lwpeer = (LWComponentPeer<?, ?>) peer;
        final Point p = lwpeer.getLocationOnScreen();
        cursor = lwpeer.getCursor(new Point(cursorPos.x - p.x,
                                            cursorPos.y - p.y));
    } else {
        cursor = (c != null) ? c.getCursor() : null;
    }
    setCursor(cursor);
}
 
Example 2
private void updateCursorImpl() {
    final Point cursorPos = getCursorPosition();
    final Component c = findComponent(cursorPos);
    final Cursor cursor;
    final Object peer = LWToolkit.targetToPeer(c);
    if (peer instanceof LWComponentPeer) {
        final LWComponentPeer<?, ?> lwpeer = (LWComponentPeer<?, ?>) peer;
        final Point p = lwpeer.getLocationOnScreen();
        cursor = lwpeer.getCursor(new Point(cursorPos.x - p.x,
                                            cursorPos.y - p.y));
    } else {
        cursor = (c != null) ? c.getCursor() : null;
    }
    setCursor(cursor);
}
 
Example 3
private void updateCursorImpl() {
    final Point cursorPos = getCursorPosition();
    final Component c = findComponent(cursorPos);
    final Cursor cursor;
    final Object peer = LWToolkit.targetToPeer(c);
    if (peer instanceof LWComponentPeer) {
        final LWComponentPeer<?, ?> lwpeer = (LWComponentPeer<?, ?>) peer;
        final Point p = lwpeer.getLocationOnScreen();
        cursor = lwpeer.getCursor(new Point(cursorPos.x - p.x,
                                            cursorPos.y - p.y));
    } else {
        cursor = (c != null) ? c.getCursor() : null;
    }
    setCursor(cursor);
}
 
Example 4
private void updateCursorImpl() {
    final Point cursorPos = getCursorPosition();
    final Component c = findComponent(cursorPos);
    final Cursor cursor;
    final Object peer = LWToolkit.targetToPeer(c);
    if (peer instanceof LWComponentPeer) {
        final LWComponentPeer<?, ?> lwpeer = (LWComponentPeer<?, ?>) peer;
        final Point p = lwpeer.getLocationOnScreen();
        cursor = lwpeer.getCursor(new Point(cursorPos.x - p.x,
                                            cursorPos.y - p.y));
    } else {
        cursor = (c != null) ? c.getCursor() : null;
    }
    setCursor(cursor);
}
 
Example 5
private void updateCursorImpl() {
    final Point cursorPos = getCursorPosition();
    final Component c = findComponent(cursorPos);
    final Cursor cursor;
    final Object peer = LWToolkit.targetToPeer(c);
    if (peer instanceof LWComponentPeer) {
        final LWComponentPeer<?, ?> lwpeer = (LWComponentPeer<?, ?>) peer;
        final Point p = lwpeer.getLocationOnScreen();
        cursor = lwpeer.getCursor(new Point(cursorPos.x - p.x,
                                            cursorPos.y - p.y));
    } else {
        cursor = (c != null) ? c.getCursor() : null;
    }
    setCursor(cursor);
}
 
Example 6
private void updateCursorImpl() {
    final Point cursorPos = getCursorPosition();
    final Component c = findComponent(cursorPos);
    final Cursor cursor;
    final Object peer = LWToolkit.targetToPeer(c);
    if (peer instanceof LWComponentPeer) {
        final LWComponentPeer<?, ?> lwpeer = (LWComponentPeer<?, ?>) peer;
        final Point p = lwpeer.getLocationOnScreen();
        cursor = lwpeer.getCursor(new Point(cursorPos.x - p.x,
                                            cursorPos.y - p.y));
    } else {
        cursor = (c != null) ? c.getCursor() : null;
    }
    setCursor(cursor);
}
 
Example 7
private void updateCursorImpl() {
    final Point cursorPos = getCursorPosition();
    final Component c = findComponent(cursorPos);
    final Cursor cursor;
    final Object peer = LWToolkit.targetToPeer(c);
    if (peer instanceof LWComponentPeer) {
        final LWComponentPeer<?, ?> lwpeer = (LWComponentPeer<?, ?>) peer;
        final Point p = lwpeer.getLocationOnScreen();
        cursor = lwpeer.getCursor(new Point(cursorPos.x - p.x,
                                            cursorPos.y - p.y));
    } else {
        cursor = (c != null) ? c.getCursor() : null;
    }
    setCursor(cursor);
}
 
Example 8
private void updateCursorImpl() {
    final Point cursorPos = getCursorPosition();
    final Component c = findComponent(cursorPos);
    final Cursor cursor;
    final Object peer = LWToolkit.targetToPeer(c);
    if (peer instanceof LWComponentPeer) {
        final LWComponentPeer<?, ?> lwpeer = (LWComponentPeer<?, ?>) peer;
        final Point p = lwpeer.getLocationOnScreen();
        cursor = lwpeer.getCursor(new Point(cursorPos.x - p.x,
                                            cursorPos.y - p.y));
    } else {
        cursor = (c != null) ? c.getCursor() : null;
    }
    setCursor(cursor);
}
 
Example 9
private void updateCursorImpl() {
    final Point cursorPos = getCursorPosition();
    final Component c = findComponent(cursorPos);
    final Cursor cursor;
    final Object peer = LWToolkit.targetToPeer(c);
    if (peer instanceof LWComponentPeer) {
        final LWComponentPeer<?, ?> lwpeer = (LWComponentPeer<?, ?>) peer;
        final Point p = lwpeer.getLocationOnScreen();
        cursor = lwpeer.getCursor(new Point(cursorPos.x - p.x,
                                            cursorPos.y - p.y));
    } else {
        cursor = (c != null) ? c.getCursor() : null;
    }
    setCursor(cursor);
}
 
Example 10
private void updateCursorImpl() {
    final Point cursorPos = getCursorPosition();
    final Component c = findComponent(cursorPos);
    final Cursor cursor;
    final Object peer = LWToolkit.targetToPeer(c);
    if (peer instanceof LWComponentPeer) {
        final LWComponentPeer<?, ?> lwpeer = (LWComponentPeer<?, ?>) peer;
        final Point p = lwpeer.getLocationOnScreen();
        cursor = lwpeer.getCursor(new Point(cursorPos.x - p.x,
                                            cursorPos.y - p.y));
    } else {
        cursor = (c != null) ? c.getCursor() : null;
    }
    setCursor(cursor);
}
 
Example 11
private void updateCursorImpl() {
    final Point cursorPos = getCursorPosition();
    final Component c = findComponent(cursorPos);
    final Cursor cursor;
    final Object peer = LWToolkit.targetToPeer(c);
    if (peer instanceof LWComponentPeer) {
        final LWComponentPeer<?, ?> lwpeer = (LWComponentPeer<?, ?>) peer;
        final Point p = lwpeer.getLocationOnScreen();
        cursor = lwpeer.getCursor(new Point(cursorPos.x - p.x,
                                            cursorPos.y - p.y));
    } else {
        cursor = (c != null) ? c.getCursor() : null;
    }
    setCursor(cursor);
}
 
Example 12
private void updateCursorImpl() {
    final Point cursorPos = getCursorPosition();
    final Component c = findComponent(cursorPos);
    final Cursor cursor;
    final Object peer = LWToolkit.targetToPeer(c);
    if (peer instanceof LWComponentPeer) {
        final LWComponentPeer<?, ?> lwpeer = (LWComponentPeer<?, ?>) peer;
        final Point p = lwpeer.getLocationOnScreen();
        cursor = lwpeer.getCursor(new Point(cursorPos.x - p.x,
                                            cursorPos.y - p.y));
    } else {
        cursor = (c != null) ? c.getCursor() : null;
    }
    setCursor(cursor);
}
 
Example 13
private void updateCursorImpl() {
    final Point cursorPos = getCursorPosition();
    final Component c = findComponent(cursorPos);
    final Cursor cursor;
    final Object peer = LWToolkit.targetToPeer(c);
    if (peer instanceof LWComponentPeer) {
        final LWComponentPeer<?, ?> lwpeer = (LWComponentPeer<?, ?>) peer;
        final Point p = lwpeer.getLocationOnScreen();
        cursor = lwpeer.getCursor(new Point(cursorPos.x - p.x,
                                            cursorPos.y - p.y));
    } else {
        cursor = (c != null) ? c.getCursor() : null;
    }
    setCursor(cursor);
}
 
Example 14
/**
 * To construct the Observer you only need to provide it with the class of Enum used
 * to contain dictinary, the Component it will be working on and acceptor of event_t's
 */
public EventObserver(Class<Handler> handlerClass, Component component, Consumer<? super event_t> doomEventConsumer) {
    this.actionStateHolder = new ActionStateHolder<>(handlerClass, this);
    this.eventSortedHandlers = sortHandlers(handlerClass.getEnumConstants());
    this.doomEventConsumer = doomEventConsumer;
    this.component = component;
    this.initialCursor = component.getCursor();
    this.hiddenCursor = createHiddenCursor();
    this.keyStateHolder = new KeyStateHolder<>();
}