当前位置: 首页>>代码示例>>Java>>正文


Java SwingUtilities.getDeepestComponentAt方法代码示例

本文整理汇总了Java中javax.swing.SwingUtilities.getDeepestComponentAt方法的典型用法代码示例。如果您正苦于以下问题:Java SwingUtilities.getDeepestComponentAt方法的具体用法?Java SwingUtilities.getDeepestComponentAt怎么用?Java SwingUtilities.getDeepestComponentAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.SwingUtilities的用法示例。


在下文中一共展示了SwingUtilities.getDeepestComponentAt方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: eventDispatched

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
@Override public void eventDispatched(AWTEvent event) {
    if (ignoreMouseEvents) {
        return;
    }
    Component root = SwingUtilities.getRoot((Component) event.getSource());
    if (root instanceof IRecordingArtifact || root.getName().startsWith("###")) {
        return;
    }
    if (!(event instanceof MouseEvent)) {
        return;
    }
    MouseEvent mouseEvent = (MouseEvent) event;
    mouseEvent.consume();
    if (event.getID() == MouseEvent.MOUSE_PRESSED) {
        disposeOverlay();
        Component mouseComponent = SwingUtilities.getDeepestComponentAt(mouseEvent.getComponent(), mouseEvent.getX(),
                mouseEvent.getY());
        if (mouseComponent == null) {
            return;
        }
        mouseEvent = SwingUtilities.convertMouseEvent(mouseEvent.getComponent(), mouseEvent, mouseComponent);
        setComponent(mouseComponent, mouseEvent.getPoint(), true);
        return;
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:26,代码来源:ContextMenuWindow.java

示例2: updateClientCursor

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
private void updateClientCursor() {
    PointerInfo pointerInfo = MouseInfo.getPointerInfo();
    if (pointerInfo == null) {
        /*
         * This can happen when multiple graphics device cannot decide
         * which graphics device contains the current mouse position
         * or on systems without a mouse
         */
         return;
    }
    Point p = pointerInfo.getLocation();
    SwingUtilities.convertPointFromScreen(p, this);
    Component target = SwingUtilities.getDeepestComponentAt(this, p.x, p.y);
    if (target != null) {
        content.setCursor(target.getCursor());
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:JLightweightFrame.java

示例3: getToolTipText

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
@Override
public String getToolTipText(MouseEvent event) {
    Component c = SwingUtilities.getDeepestComponentAt(this, event.getX(), event.getY());
    if (c instanceof JComponent) {
        JComponent jc = (JComponent) c;
        String tooltip = jc.getToolTipText();
        if (null != tooltip) {
            return tooltip;
        }
    }
    return super.getToolTipText(event);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:RendererPanel.java

示例4: getDeepestComponent

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
private Component getDeepestComponent(MouseEvent e) {
    Point contentPanePoint
            = SwingUtilities.convertPoint(glassPane,
                                          e.getPoint(),
                                          contentPane);
    return SwingUtilities.getDeepestComponentAt(
                    contentPane,
                    contentPanePoint.x,
                    contentPanePoint.y);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:SimpleTestStepLocation.java

示例5: getActiveComponent

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
public static Component getActiveComponent(Component component, int x, int y) {
    Component componentx = SwingUtilities.getDeepestComponentAt(component, x, y);
    if (componentx == null) {
        return component;
    }
    return componentx;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:8,代码来源:Device.java

示例6: showPopup

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
public void showPopup(MouseEvent mouseEvent) {
    if (isContextMenuOn()) {
        return;
    }
    Component component = SwingUtilities.getDeepestComponentAt(mouseEvent.getComponent(), mouseEvent.getX(), mouseEvent.getY());
    if (component == null) {
        return;
    }
    if (component instanceof JMenuItem && (!(component instanceof JMenu) || ((JMenu) component).isSelected())) {
        return;
    }
    Point point = SwingUtilities.convertPoint(mouseEvent.getComponent(), mouseEvent.getPoint(), component);
    showPopup(component, point);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:15,代码来源:ContextMenuHandler.java

示例7: shouldSelectCell

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
public boolean shouldSelectCell(EventObject anEvent) {
  if( editorComponent != null && anEvent instanceof MouseEvent
    && ((MouseEvent)anEvent).getID() == MouseEvent.MOUSE_PRESSED )
  {
          Component dispatchComponent = SwingUtilities.getDeepestComponentAt(editorComponent, 3, 3 );
    ((CopyButton) dispatchComponent).setSelected(true);
  }
  return false;
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:10,代码来源:TranslateWindow.java

示例8: updateClientCursor

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
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());
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:JLightweightFrame.java

示例9: redispatchComponent

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
private boolean redispatchComponent(MouseEvent e) {
    Point p = e.getPoint();
    int index = list.locationToIndex(p);
    if (index < 0 || index >= list.getModel().getSize()) {
        return false;
    }

    ListCellRenderer renderer = list.getCellRenderer();
    if (null == renderer) {
        return false;
    }
    Component renComponent = renderer.getListCellRendererComponent(list, list.getModel().getElementAt(index), index, false, false);
    if (null == renComponent) {
        return false;
    }
    Rectangle rect = list.getCellBounds(index, index);
    if (null == rect) {
        return false;
    }
    renComponent.setBounds(0, 0, rect.width, rect.height);
    renComponent.doLayout();
    Point p3 = rect.getLocation();

    Point p2 = new Point(p.x - p3.x, p.y - p3.y);
    Component dispatchComponent =
            SwingUtilities.getDeepestComponentAt(renComponent,
            p2.x, p2.y);
    if ( e.isPopupTrigger() &&
         dispatchComponent instanceof LinkButton && 
         !((LinkButton)dispatchComponent).isHandlingPopupEvents() ) 
    {
        return false;
    } 
    if (dispatchComponent instanceof AbstractButton) {
        if (!((AbstractButton) dispatchComponent).isEnabled()) {
            return false;
        }
        Point p4 = SwingUtilities.convertPoint(renComponent, p2, dispatchComponent);
        MouseEvent newEvent = new MouseEvent(dispatchComponent,
                e.getID(),
                e.getWhen(),
                e.getModifiers(),
                p4.x, p4.y,
                e.getClickCount(),
                e.isPopupTrigger(),
                MouseEvent.NOBUTTON);
        dispatchComponent.dispatchEvent(newEvent);
        list.repaint(rect);
        e.consume();
        return true;
    }
    return false;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:54,代码来源:AbstractListUI.java

示例10: setDispatchComponent

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
private void setDispatchComponent(MouseEvent e) {
	Component editorComponent = header.getEditorComponent();
	Point p = e.getPoint();
	Point p2 = SwingUtilities.convertPoint(header, p, editorComponent);
	dispatchComponent = SwingUtilities.getDeepestComponentAt(editorComponent, p2.x, p2.y);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:7,代码来源:EditableTableHeaderUI.java


注:本文中的javax.swing.SwingUtilities.getDeepestComponentAt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。