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

The following examples show how to use java.awt.Component#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: LWCursorManager.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
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
Source File: LWCursorManager.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
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
Source File: LWCursorManager.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
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
Source File: LWCursorManager.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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
Source File: LWCursorManager.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
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
Source File: LWCursorManager.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
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
Source File: LWCursorManager.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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
Source File: LWCursorManager.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
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
Source File: LWCursorManager.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
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
Source File: LWCursorManager.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
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
Source File: LWCursorManager.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
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
Source File: LWCursorManager.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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
Source File: LWCursorManager.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
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
Source File: EventObserver.java    From mochadoom with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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<>();
}