當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。