java.awt.MouseInfo Java Examples

The following examples show how to use java.awt.MouseInfo. 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: UpdateProgressBar.java    From stendhal with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates update progress bar.
 *
 * @param max max file size
 * @param urlBase base url for the browser
 * @param fromVersion the version the update is based on, may be <code>null</code>
 * @param toVersion the version the download leads to
 */
UpdateProgressBar(final int max, final String urlBase, final String fromVersion, final String toVersion) {
	super("Downloading...", MouseInfo.getPointerInfo().getDevice().getDefaultConfiguration());
	setLocationByPlatform(true);
	setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
	addWindowListener(new UpdateProgressBarWindowListener());

	this.max = max;
	this.urlBase = urlBase;
	this.fromVersion = fromVersion;
	this.toVersion = toVersion;

	try {
		final URL url = this.getClass().getClassLoader().getResource(
				ClientGameConfiguration.get("GAME_ICON"));
		setIconImage(new ImageIcon(url).getImage());
	} catch (final RuntimeException e) {
		// in case that resource is not available
	}

	initializeComponents();

	this.pack();
}
 
Example #2
Source File: AutoScrollHandler.java    From phoebus with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Scrolls the {@link ScrollPane} along the given {@code edge}.
 *
 * @param edge The scrolling side.
 */
private void scroll ( Edge edge ) {

    if ( edge == null ) {
        return;
    }

    Point screenLocation = MouseInfo.getPointerInfo().getLocation();
    Point2D localLocation = scrollPane.screenToLocal(screenLocation.getX(), screenLocation.getY());

    switch ( edge ) {
        case LEFT:
            scrollPane.setHvalue(scrollPane.getHvalue() + Math.min(1.0, localLocation.getX() / 2.0) / scrollPane.getWidth());
            break;
        case RIGHT:
            scrollPane.setHvalue(scrollPane.getHvalue() + Math.max(1.0, ( localLocation.getX() - scrollPane.getWidth() ) / 2.0) / scrollPane.getWidth());
            break;
        case TOP:
            scrollPane.setVvalue(scrollPane.getVvalue() + Math.min(1.0, localLocation.getY() / 2.0) / scrollPane.getHeight());
            break;
        case BOTTOM:
            scrollPane.setVvalue(scrollPane.getVvalue() + Math.max(1.0, ( localLocation.getY() - scrollPane.getHeight() ) / 2.0) / scrollPane.getHeight());
            break;
    }

}
 
Example #3
Source File: CursorUtils.java    From gef with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Returns the current pointer location.
 *
 * @return The current pointer location.
 */
public static Point getPointerLocation() {
	// XXX: Ensure AWT is not considered to be in headless mode, as
	// otherwise MouseInfo#getPointerInfo() will not work; therefore
	// adjust AWT headless property, if required
	String awtHeadlessPropertyValue = System
			.getProperty(JAVA_AWT_HEADLESS_PROPERTY);
	if (awtHeadlessPropertyValue != null
			&& awtHeadlessPropertyValue != Boolean.FALSE.toString()) {
		System.setProperty(JAVA_AWT_HEADLESS_PROPERTY,
				Boolean.FALSE.toString());
	}
	// retrieve mouse location
	PointerInfo pi = MouseInfo.getPointerInfo();
	java.awt.Point mp = pi.getLocation();

	// restore AWT headless property
	if (awtHeadlessPropertyValue != null) {
		System.setProperty(JAVA_AWT_HEADLESS_PROPERTY,
				awtHeadlessPropertyValue);
	}
	return new Point(mp.x, mp.y);
}
 
Example #4
Source File: FreeColButtonUI.java    From freecol with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void paint(Graphics g, JComponent c) {
    LAFUtilities.setProperties(g, c);

    if (c.isOpaque()) {
        ImageLibrary.drawTiledImage("image.background.FreeColButton",
                                    g, c, null);
    }
    super.paint(g, c);

    AbstractButton a = (AbstractButton) c;
    if (a.isRolloverEnabled()) {
        Point p = MouseInfo.getPointerInfo().getLocation();
        SwingUtilities.convertPointFromScreen(p, c);
        boolean rollover = c.contains(p);
        if (rollover) {
            paintButtonPressed(g, (AbstractButton) c);
        }
    }
}
 
Example #5
Source File: DockItem.java    From phoebus with Eclipse Public License 1.0 6 votes vote down vote up
/** Handle that this tab was dragged elsewhere, or drag aborted */
private void handleDragDone(final DragEvent event)
{
    final DockItem item = dragged_item.getAndSet(null);
    if (item != null  &&  !event.isDropCompleted())
    {
        // Would like to position new stage where the mouse was released,
        // but event.getX(), getSceneX(), getScreenX() are all 0.0.
        // --> Using MouseInfo, which is actually AWT code
        final Stage other = item.detach();
        final PointerInfo pi = MouseInfo.getPointerInfo();
        if (pi != null)
        {
            final Point loc = pi.getLocation();
            other.setX(loc.getX());
            other.setY(loc.getY());
        }
    }
    event.consume();
}
 
Example #6
Source File: Joystick.java    From jace with GNU General Public License v2.0 6 votes vote down vote up
public Joystick(int port, Computer computer) {
    super(computer);
    centerPoint = new Point(screenSize.width / 2, screenSize.height / 2);
    this.port = port;
    if (port == 0) {
        xSwitch = (MemorySoftSwitch) SoftSwitches.PDL0.getSwitch();
        ySwitch = (MemorySoftSwitch) SoftSwitches.PDL1.getSwitch();
    } else {
        xSwitch = (MemorySoftSwitch) SoftSwitches.PDL2.getSwitch();
        ySwitch = (MemorySoftSwitch) SoftSwitches.PDL3.getSwitch();
    }
    lastMouseLocation = MouseInfo.getPointerInfo().getLocation();
    try {
        robot = new Robot();
    } catch (AWTException ex) {
        Logger.getLogger(Joystick.class.getName()).log(Level.SEVERE, null, ex);
    }
}
 
Example #7
Source File: UIMouse.java    From open-ig with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Create a mouse movement event as if the mouse just
 * moved to its current position.
 * @param c the base swing component to relativize the mouse location
 * @return the mouse event
 */
public static UIMouse createCurrent(Component c) {
	UIMouse m = new UIMouse();
	m.type = UIMouse.Type.MOVE;
	PointerInfo pointerInfo = MouseInfo.getPointerInfo();
	if (pointerInfo != null) {
		Point pm = pointerInfo.getLocation();
		Point pc = new Point(0, 0);
		try {
			pc = c.getLocationOnScreen();
		} catch (IllegalStateException ex) {
			// ignored
		}
		m.x = pm.x - pc.x;
		m.y = pm.y - pc.y;
	}
	return m;
}
 
Example #8
Source File: Main.java    From KJController with Apache License 2.0 6 votes vote down vote up
/**
 * 处理鼠标移动
 */
public void mouseMove(String info) {
    String args[] = info.split(",");
    String x = args[0];
    String y = args[1];
    float px = Float.valueOf(x);
    float py = Float.valueOf(y);

    PointerInfo pinfo = MouseInfo.getPointerInfo(); // 得到鼠标的坐标
    java.awt.Point p = pinfo.getLocation();
    double mx = p.getX(); // 得到当前电脑鼠标的坐标
    double my = p.getY();
    try {
        java.awt.Robot robot = new Robot();
        robot.mouseMove((int) (mx + px), (int) (my + py));
    } catch (AWTException e) {
    }
}
 
Example #9
Source File: MouseEngine.java    From Dayon with GNU General Public License v3.0 6 votes vote down vote up
@java.lang.SuppressWarnings("squid:S2189")
private void mainLoop() throws InterruptedException {
    long start = System.currentTimeMillis();
    int captureCount = 0;

    Point previous = new Point(-1, -1);

    //noinspection InfiniteLoopStatement
    while (true) {
        final Point current = MouseInfo.getPointerInfo().getLocation();

        ++captureCount;

        if (!current.equals(previous) && fireOnLocationUpdated(current)) {
            previous = current;
        }

        final int delayedCaptureCount = syncOnTick(start, captureCount);

        captureCount += delayedCaptureCount;
    }
}
 
Example #10
Source File: WorldInputListener.java    From Creatures with GNU General Public License v2.0 6 votes vote down vote up
public void handlePressedMouseButtons(WorldView view) {
	double deltaX = MouseInfo.getPointerInfo().getLocation().x - lastPosition.x;
	double deltaY = MouseInfo.getPointerInfo().getLocation().y - lastPosition.y;

	if (rightButtonPressed || leftButtonPressed) {
		if (Math.abs(deltaX) > 0) {
			controller.changeOffsetX(((int) deltaX) * view.getZoomFactor());
		}

		if (Math.abs(deltaY) > 0) {
			controller.changeOffsetY(((int) deltaY) * view.getZoomFactor());
		}
	}

	lastPosition = MouseInfo.getPointerInfo().getLocation();
}
 
Example #11
Source File: FressaFunctions.java    From jclic with GNU General Public License v2.0 6 votes vote down vote up
public void disableScanning() {
  if (withSwaying) {
    stopSwayingTimer();
  }
  stopScanning();

  stopScanTimer();
  Toolkit.getDefaultToolkit().removeAWTEventListener(autoScanMouseListener);
  Toolkit.getDefaultToolkit().removeAWTEventListener(mouseDirectedScanListener);
  Toolkit.getDefaultToolkit().removeAWTEventListener(directedScanKeyboardListener);
  if (autoAutoScan) {
    Point p = MouseInfo.getPointerInfo().getLocation();
    cursorPosX = p.x;
    cursorPosY = p.y;
    tickCountTime = System.currentTimeMillis();
  }
}
 
Example #12
Source File: DeckCellRenderer.java    From magarena with GNU General Public License v3.0 6 votes vote down vote up
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {

    String deckName = (String) value;
    JLabel lbl = new JLabel(deckName);
    lbl.setOpaque(true);

    if (isSelected) {
        lbl.setForeground(table.getSelectionForeground());
        lbl.setBackground(table.getSelectionBackground());
    } else {
        lbl.setForeground(table.getForeground());
        lbl.setBackground(table.getBackground());
    }

    Point mp = MouseInfo.getPointerInfo().getLocation();
    SwingUtilities.convertPointFromScreen(mp, table);
    int mRow = table.rowAtPoint(mp);
    int mCol = table.columnAtPoint(mp);
    if (row == mRow && column == mCol) {
        lbl.setForeground(Color.blue);
        lbl.setFont(withUnderline);
    }

    return lbl;
}
 
Example #13
Source File: Demo_MouseLoopAroundScreen.java    From haxademic with MIT License 6 votes vote down vote up
public void post() {
	// update mouse w/system location
	mousePoint = MouseInfo.getPointerInfo().getLocation();
	DebugView.setValue("mousePoint.x", mousePoint.x);
	DebugView.setValue("mousePoint.y", mousePoint.y);
	
	// wrap mouse 
	int padding = 1;
	if(p.frameCount > lastLoopFrame + 1) {
		if(mousePoint.x == p.displayWidth - 1 && lastMousePoint.x < mousePoint.x) { Mouse.movePointerTo(padding, mousePoint.y); lastLoopFrame = p.frameCount; }
		else if(mousePoint.x == 0 && lastMousePoint.x > mousePoint.x) { Mouse.movePointerTo(p.displayWidth - padding, mousePoint.y); lastLoopFrame = p.frameCount; }
		else if(mousePoint.y == p.displayHeight - 1 && lastMousePoint.y < mousePoint.y) { Mouse.movePointerTo(mousePoint.x, padding); lastLoopFrame = p.frameCount; }
		else if(mousePoint.y == 0 && lastMousePoint.y > mousePoint.y) { Mouse.movePointerTo(mousePoint.x, p.displayHeight - padding); lastLoopFrame = p.frameCount; }
	}
	
	// store last mouse position
	lastMousePoint.setLocation(mousePoint);
}
 
Example #14
Source File: RequestTypeManager.java    From milkman with MIT License 6 votes vote down vote up
@SneakyThrows
private CompletableFuture<Optional<RequestTypePlugin>> getRequestTypePluginQuick(Node node) {
	List<RequestTypePlugin> requestTypePlugins = plugins.loadRequestTypePlugins();
	
	if (requestTypePlugins.size() == 0)
		throw new IllegalArgumentException("No RequestType plugins found");
	
	ContextMenu ctxMenu = new ContextMenu();
	CompletableFuture<RequestTypePlugin> f = new CompletableFuture<RequestTypePlugin>();
	requestTypePlugins.forEach(rtp -> {
		var itm = new MenuItem(rtp.getRequestType());
		itm.setOnAction(e -> {
			f.complete(rtp);
		});
		ctxMenu.getItems().add(itm);
	});
	ctxMenu.setOnCloseRequest(e -> f.complete(null));
	
	Point location = MouseInfo.getPointerInfo().getLocation();
	ctxMenu.show(node, location.getX(), location.getY());
	return f.thenApply(Optional::ofNullable);
}
 
Example #15
Source File: PlayerCellRenderer.java    From magarena with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
    String profileGUID = (String)value;
    PlayerProfile player = PlayerProfiles.getPlayerProfiles().get(profileGUID);
    boolean isTempPlayer = player == null;
    final JLabel lbl = new JLabel(!isTempPlayer ? player.getPlayerName() : "");
    lbl.setOpaque(true);
    if (isSelected) {
        lbl.setForeground(table.getSelectionForeground());
        lbl.setBackground(table.getSelectionBackground());
    } else {
        lbl.setForeground(table.getForeground());
        lbl.setBackground(table.getBackground());
    }
    if (isTempPlayer) {
        lbl.setForeground(Color.GRAY);
    } else {
        Point mp = MouseInfo.getPointerInfo().getLocation();
        SwingUtilities.convertPointFromScreen(mp, table);
        int mRow = table.rowAtPoint(mp);
        int mCol = table.columnAtPoint(mp);
        if (row == mRow && column == mCol) {
            lbl.setForeground(Color.blue);
            lbl.setFont(withUnderline);
        }
    }
    return lbl;
}
 
Example #16
Source File: MousePrintRecorder.java    From sc2gears with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the current location of the mouse cursor.<br>
 * On Windows if the workstation is locked (the login screen is displayed), the mouse location is not available
 * and <code>null</code> is returned. Also if a mouse is not present, <code>null</code> is returned.
 * @return the current location of the mouse cursor.
 */
private Point getMouseLocation() {
	final PointerInfo pointerInfo = MouseInfo.getPointerInfo();
	if ( pointerInfo == null ) // Mouse not present?
		return null;
	
	final Point location = pointerInfo.getLocation();
	
	// Some big random number is returned if the workstation is locked on Windows
	if ( location.x < -20000 || location.x > 20000 || location.y < -20000 || location.y > 20000 )
		return null;
	
	return location;
}
 
Example #17
Source File: JLightweightFrame.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private void updateClientCursor() {
    Point p = MouseInfo.getPointerInfo().getLocation();
    SwingUtilities.convertPointFromScreen(p, this);
    Component target = SwingUtilities.getDeepestComponentAt(this, p.x, p.y);
    if (target != null) {
        content.setCursor(target.getCursor());
    }
}
 
Example #18
Source File: MouseInfoClass.java    From trygve with GNU General Public License v2.0 5 votes vote down vote up
@Override public RTCode runDetails(final RTObject myEnclosedScope) {
	final RTDynamicScope activationRecord = RunTimeEnvironment.runTimeEnvironment_.currentDynamicScope();
	final PointerInfo pointerInfo = MouseInfo.getPointerInfo();
	final RTPointerInfoObject retval = new RTPointerInfoObject(pointerInfo);
	
	addRetvalTo(activationRecord);
	activationRecord.setObject("ret$val", retval);
	
	return super.nextCode();
}
 
Example #19
Source File: StartScreen.java    From WorldGrower with GNU General Public License v3.0 5 votes vote down vote up
private void showNewGamePopupMenu() {
	JPopupMenu popupMenu = MenuFactory.createJPopupMenu(imageInfoReader);
	
	popupMenu.add(createMenuItem(new TutorialAction(), IconUtils.getNewTutorialGameIcon(), "Start a tutorial game in which the basics of the game are explained"));
	popupMenu.add(createMenuItem(new StandardGameAction(), IconUtils.getNewStandardGameIcon(), "Start a game with default settings"));
	popupMenu.add(createMenuItem(new CustomGameAction(), IconUtils.getNewCustomGameIcon(), "Start a game with customizing settings beforehand"));
	
	Point mouseLocation = MouseInfo.getPointerInfo().getLocation();
	SwingUtilities.convertPointFromScreen(mouseLocation, frame);
	popupMenu.show(frame, mouseLocation.x, mouseLocation.y);
}
 
Example #20
Source File: FastCopyMainForm.java    From FastCopy with Apache License 2.0 5 votes vote down vote up
public void init() {
	frame = new JFrame("MHISoft FastCopy " + UI.version);
	frame.setContentPane(layoutPanel1);
	frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	//progressBar1.setVisible(false);
	progressBar1.setMaximum(100);
	progressBar1.setMinimum(0);

	progressPanel.setVisible(false);
	//frame.setPreferredSize(new Dimension(1200, 800));
	frame.setPreferredSize(new Dimension(UserPreference.getInstance().getDimensionX(), UserPreference.getInstance().getDimensionY()));

	frame.pack();

	/*position it*/
	//frame.setLocationRelativeTo(null);  // *** this will center your app ***
	PointerInfo a = MouseInfo.getPointerInfo();
	Point b = a.getLocation();
	int x = (int) b.getX();
	int y = (int) b.getY();
	frame.setLocation(x + 100, y);

	btnHelp.setBorder(null);

	frame.setVisible(true);


	componentsList = ViewHelper.getAllComponents(frame);
	setupFontSpinner();
	ViewHelper.setFontSize(componentsList, UserPreference.getInstance().getFontSize());



}
 
Example #21
Source File: TimeMenuPanel.java    From LGoodDatePicker with MIT License 5 votes vote down vote up
public void mouseDraggedFromToggleButton() {
    Point mousePositionRelativeToScreen = MouseInfo.getPointerInfo().getLocation();
    Rectangle timeListBounds = timeList.getBounds();
    timeListBounds.setLocation(timeList.getLocationOnScreen());
    if (timeListBounds.contains(mousePositionRelativeToScreen)) {
        SwingUtilities.convertPointFromScreen(mousePositionRelativeToScreen, timeList);
        Point mousePositionRelativeToComponent = (Point) mousePositionRelativeToScreen.clone();
        int index = timeList.locationToIndex(mousePositionRelativeToComponent);
        if ((index != -1) && (index != timeList.getSelectedIndex())) {
            timeList.setSelectedIndex(index);
        }
    }
}
 
Example #22
Source File: JLightweightFrame.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private void updateClientCursor() {
    Point p = MouseInfo.getPointerInfo().getLocation();
    SwingUtilities.convertPointFromScreen(p, this);
    Component target = SwingUtilities.getDeepestComponentAt(this, p.x, p.y);
    if (target != null) {
        content.setCursor(target.getCursor());
    }
}
 
Example #23
Source File: JLightweightFrame.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
private void updateClientCursor() {
    Point p = MouseInfo.getPointerInfo().getLocation();
    SwingUtilities.convertPointFromScreen(p, this);
    Component target = SwingUtilities.getDeepestComponentAt(this, p.x, p.y);
    if (target != null) {
        content.setCursor(target.getCursor());
    }
}
 
Example #24
Source File: MagnificationPanel.java    From pumpernickel with MIT License 5 votes vote down vote up
protected Point getMouseLoc() {
	// I observed a null PointerInfo after unplugging a second monitor
	PointerInfo pointerInfo = MouseInfo.getPointerInfo();
	if (pointerInfo == null)
		return null;
	Point p = pointerInfo.getLocation();
	SwingUtilities.convertPointFromScreen(p, zoomedComponent);
	return p;
}
 
Example #25
Source File: BasicPopoverVisibility.java    From pumpernickel with MIT License 5 votes vote down vote up
/**
 * Return true if the mouse is currently over the argument.
 */
protected boolean isRollover(JComponent jc) {
	if (!jc.isShowing())
		return false;
	Point p = jc.getLocationOnScreen();
	int w = jc.getWidth();
	int h = jc.getHeight();

	Point mouse = MouseInfo.getPointerInfo().getLocation();

	return mouse.x >= p.x && mouse.y >= p.y && mouse.x < p.x + w
			&& mouse.y < p.y + h;
}
 
Example #26
Source File: JLightweightFrame.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private void updateClientCursor() {
    Point p = MouseInfo.getPointerInfo().getLocation();
    SwingUtilities.convertPointFromScreen(p, this);
    Component target = SwingUtilities.getDeepestComponentAt(this, p.x, p.y);
    if (target != null) {
        content.setCursor(target.getCursor());
    }
}
 
Example #27
Source File: JLightweightFrame.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private void updateClientCursor() {
    Point p = MouseInfo.getPointerInfo().getLocation();
    SwingUtilities.convertPointFromScreen(p, this);
    Component target = SwingUtilities.getDeepestComponentAt(this, p.x, p.y);
    if (target != null) {
        content.setCursor(target.getCursor());
    }
}
 
Example #28
Source File: RecentFileAction.java    From constellation with Apache License 2.0 5 votes vote down vote up
/**
 * Workaround for JDK bug 6663119, it ensures that first item in submenu is
 * correctly selected during keyboard navigation.
 */
private void ensureSelected() {
    if (menu.getMenuComponentCount() <= 0) {
        return;
    }

    Component first = menu.getMenuComponent(0);
    if (!(first instanceof JMenuItem)) {
        return;
    }

    Point loc = MouseInfo.getPointerInfo().getLocation();
    SwingUtilities.convertPointFromScreen(loc, menu);
    MenuElement[] selPath
            = MenuSelectionManager.defaultManager().getSelectedPath();

    // apply workaround only when mouse is not hovering over menu
    // (which signalizes mouse driven menu traversing) and only
    // when selected menu path contains expected value - submenu itself
    if (!menu.contains(loc) && selPath.length > 0
            && menu.getPopupMenu() == selPath[selPath.length - 1]) {
        // select first item in submenu through MenuSelectionManager
        MenuElement[] newPath = new MenuElement[selPath.length + 1];
        System.arraycopy(selPath, 0, newPath, 0, selPath.length);
        JMenuItem firstItem = (JMenuItem) first;
        newPath[selPath.length] = firstItem;
        MenuSelectionManager.defaultManager().setSelectedPath(newPath);
    }
}
 
Example #29
Source File: WindowUtils.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
/** Attempts to force the app to the front. */
public static void forceAppToFront() {
    // Calling Desktop.isDesktopSupported() generally doesn't have the desired effect on Windows
    boolean force = Platform.isWindows();
    if (Desktop.isDesktopSupported()) {
        try {
            Desktop.getDesktop().requestForeground(true);
        } catch (UnsupportedOperationException uoex) {
            force = true;
        }
    }
    if (force) {
        BaseWindow topWindow = BaseWindow.getTopWindow();
        if (topWindow != null) {
            if (!topWindow.isVisible()) {
                topWindow.setVisible(true);
            }
            boolean alwaysOnTop = topWindow.isAlwaysOnTop();
            topWindow.setExtendedState(Frame.NORMAL);
            topWindow.toFront();
            topWindow.setAlwaysOnTop(true);
            try {
                Point savedMouse = MouseInfo.getPointerInfo().getLocation();
                Robot robot      = new Robot();
                robot.mouseMove(topWindow.getX() + 100, topWindow.getY() + 10);
                robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
                robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
                robot.mouseMove(savedMouse.x, savedMouse.y);
            } catch (Exception ex) {
                Log.warn(ex);
            } finally {
                topWindow.setAlwaysOnTop(alwaysOnTop);
            }
        }
    }
}
 
Example #30
Source File: ShowTabsButton.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
private void updateRollOver() {
    boolean wasBorderShown = mShowBorder;
    Point   location       = MouseInfo.getPointerInfo().getLocation();
    UIUtilities.convertPointFromScreen(location, this);
    mShowBorder = isOver(location.x, location.y);
    if (wasBorderShown != mShowBorder) {
        repaint();
    }
}