/** * Asynchronously checks the current position of the mouse and updates the cursor if necessary. */ protected void checkMousePositionAsync() { DockController controller = station.getController(); if (controller != null && !awtListenerEnabled) { SwingUtilities.invokeLater( new Runnable() { public void run() { if (container != null) { PointerInfo p = MouseInfo.getPointerInfo(); Point e = p.getLocation(); SwingUtilities.convertPointFromScreen(e, container); current = getDividerNode(e.x, e.y); if (current == null) { mouseExited(null); } else { // check bounds with one pixel delta -> divider needs to be greater than 2 // pixels, because divider bounds will be shrinked by 1 pixel at each side if (bounds.width > 2 && bounds.height > 2) { if (e.x <= bounds.x || e.x >= bounds.x + bounds.width - 1 || e.y <= bounds.y || e.y >= bounds.y + bounds.height - 1) { // mouse is likely to be not on divider anymore mouseExited(null); } } } } } }); } }
public void install(Component container) { if (this.container != null) { throw new IllegalStateException("already initialized"); } this.container = container; container.addMouseListener(this); container.addMouseMotionListener(this); station.addDockHierarchyListener(this); setController(station.getController()); }
/** * Asynchronously checks the current position of the mouse and updates the cursor if necessary. */ protected void checkMousePositionAsync() { DockController controller = station.getController(); if (controller != null && !controller.isRestrictedEnvironment()) { SwingUtilities.invokeLater( new Runnable() { public void run() { if (container != null) { PointerInfo p = MouseInfo.getPointerInfo(); Point e = p.getLocation(); SwingUtilities.convertPointFromScreen(e, container); current = station.getRoot().getDividerNode(e.x, e.y); if (current == null) { setCursor(null); } } } }); } }
public void controllerChanged(DockHierarchyEvent event) { setController(station.getController()); }