public class SortFilterTableHeaderUI extends BasicTableHeaderUI { private Component filteredComponent; @Override protected MouseInputListener createMouseInputListener() { return new MouseInputHandler() { @Override public void mouseClicked(MouseEvent e) { if (!filteredComponent.contains(e.getPoint())) super.mouseClicked(e); } }; } }
/** * Is the specified mouse event within the active area? */ protected boolean contains (MouseEvent e) { if (bounds != null) { return bounds.contains(e.getX(), e.getY()); } else { return component.contains(e.getX(), e.getY()); } }
public boolean containsScreenPoint( Point point ){ point = new Point(point); Component parent = window.asComponent(); SwingUtilities.convertPointFromScreen(point, parent); return parent.contains(point); }
public boolean contains( int x, int y ){ Component component = getComponent(); if( component == null ){ return true; } Point point = new Point( x, y ); SwingUtilities.convertPointFromScreen( point, component ); return component.contains( point ); }
public boolean containsScreenPoint( Point point ){ point = new Point(point); Component parent = window.asComponent(); SwingUtilities.convertPointFromScreen(point, parent); return parent.contains(point); }
public boolean contains( int x, int y ){ Component component = getWindowComponent(); Point point = new Point( x, y ); SwingUtilities.convertPointFromScreen( point, component ); return component.contains( point ); }
public boolean contains( int x, int y ){ Component component = getComponent(); if( component == null ){ return true; } Point point = new Point( x, y ); SwingUtilities.convertPointFromScreen( point, component ); return component.contains( point ); }
public boolean contains( int x, int y ){ Component component = getWindowComponent(); Point point = new Point( x, y ); SwingUtilities.convertPointFromScreen( point, component ); return component.contains( point ); }
@Override public void mouseReleased(MouseEvent e) { Point releasedAt = e.getPoint(); SwingUtilities.convertPointToScreen(releasedAt, e.getComponent()); Point clickedAt = pressPoint; lastClickPoint = clickedAt; pressPoint = null; if (e.isConsumed() || clickedAt == null || e.isPopupTrigger() || !e.getComponent().contains(e.getPoint())) { return; } if (isWithinEps(releasedAt, clickedAt) && onClick(e, clickCount)) { e.consume(); } } };
@Override public void mouseReleased(MouseEvent e) { Point releasedAt = e.getPoint(); SwingUtilities.convertPointToScreen(releasedAt, e.getComponent()); Point clickedAt = pressPoint; lastClickPoint = clickedAt; pressPoint = null; if (e.isConsumed() || clickedAt == null || e.isPopupTrigger() || !e.getComponent().contains(e.getPoint())) { return; } if (isWithinEps(releasedAt, clickedAt) && onClick(e, clickCount)) { e.consume(); } } };
public void mousePressed(MouseEvent ev) { Component w = (Component) ev.getSource(); if (w != null) { if (floatingWindow != null) floatingWindow.toFront(); Point dragWindowOffset = ev.getPoint(); Point convertedDragWindowOffset = SwingUtilities.convertPoint(w, dragWindowOffset, ev.getComponent()); if (ev.getComponent() != null && ev.getComponent().contains(convertedDragWindowOffset)) { if (dragWindowOffset.y >= BORDER_DRAG_THICKNESS && dragWindowOffset.x >= BORDER_DRAG_THICKNESS && dragWindowOffset.x < w.getWidth() - BORDER_DRAG_THICKNESS) { isMovingWindow = true; dragOffsetX = dragWindowOffset.x; dragOffsetY = dragWindowOffset.y; } } } }
@Override protected boolean checkCondition(){ MouseEvent event = latestEvent; if( event == null ){ return false; } Point location = event.getPoint(); Component component = getComponent().getComponent(); location = SwingUtilities.convertPoint( event.getComponent(), location, component ); return component.contains( location ); }
@Override protected boolean checkCondition(){ MouseEvent event = latestEvent; if( event == null ){ return false; } Point location = event.getPoint(); Component component = getComponent().getComponent(); location = SwingUtilities.convertPoint( event.getComponent(), location, component ); return component.contains( location ); }
private synchronized void addEventToQueue(int x, int y) { Point p = new Point(x, y); // from absolute to relative position p.setLocation(x - SOURCE.getLocationOnScreen().x, y - SOURCE.getLocationOnScreen().y); if (!SOURCE.contains(p)) { MouseClickOutsideComponentEvent event = new MouseClickOutsideComponentEvent(SOURCE, MouseEvent.MOUSE_CLICKED, new Date().getTime(), 0, p.x, p.y, 1, true, MouseEvent.BUTTON1); SOURCE.getToolkit().getDefaultToolkit().getSystemEventQueue().postEvent(event); } }
@Override public boolean contains(final int x, final int y) { if (super.contains(x, y)) return true; for(int i = 0; i < getComponentCount(); i++){ final Component comp = getComponent(i); if(comp.isVisible() && comp.contains(x-comp.getX(), y-comp.getY())) return true; } return false; }
public boolean titleContains( int x, int y ){ DockTitle title = getTitle(); if( title == null ) return false; Component component = getComponent( title ); Point point = new Point( x, y ); point = SwingUtilities.convertPoint( this, point, component ); point.x -= component.getX(); point.y -= component.getY(); return component.contains( point ); }
public boolean titleContains( int x, int y ){ DockTitle title = getTitle(); if( title == null ) return false; Component component = getComponent( title ); Point point = new Point( x, y ); point = SwingUtilities.convertPoint( this, point, component ); point.x -= component.getX(); point.y -= component.getY(); return component.contains( point ); }
protected void checkMouseEnterExit(MouseEvent e, Point lnewPoint, Component lprevc, Component lc) { if (lprevc != lc) { if (lprevc != null) { Point lpt = convertPoint(lnewPoint, lprevc); if (!lprevc.contains(lpt)) { MouseListener[] lprevmml = lprevc.getMouseListeners(); for (int i = 0; i < lprevmml.length; i++) { lprevmml[i].mouseExited(cloneMouseEvent(e, lprevc, MouseEvent.MOUSE_EXITED, lpt)); } } } if (lc != null) { Point lpt = convertPoint(lnewPoint, lc); if (lc.contains(lpt)) { MouseListener[] lcmml = lc.getMouseListeners(); for (int i = 0; i < lcmml.length; i++) { lcmml[i].mouseEntered(cloneMouseEvent(e, lc, MouseEvent.MOUSE_ENTERED, lpt)); } } } } }
@Override public boolean contains(final int x, final int y) { final int space = getMap().getZoomed(NodeView.SPACE_AROUND); final int reducedSpace = space - ADDITIONAL_MOUSE_SENSITIVE_AREA; if (x >= reducedSpace && x < getWidth() - reducedSpace && y >= reducedSpace && y < getHeight() - reducedSpace){ for(int i = getComponentCount()-1; i >= 0; i--){ final Component comp = getComponent(i); if(comp.isVisible() && comp.contains(x-comp.getX(), y-comp.getY())) return true; } } return false; }
/** * Tells whether the given point is inside a button. * @param x the x-coordinate * @param y the y-coordinate * @return <code>true</code> if the point is inside a child of this panel */ public boolean titleContains( int x, int y ){ if( getComponentCount() == 0 ){ int w = getWidth() / 3; int h = getHeight() / 3; return contains( x - w, y - h ) && contains( x + w, y + h ); } for( int i = 0, n = getComponentCount(); i<n; i++ ){ Component c = getComponent( i ); if( c.contains( x - c.getX(), y - c.getY() )) return true; } return false; }