當前位置: 首頁>>代碼示例>>Java>>正文


Java SwingUtilities.convertMouseEvent方法代碼示例

本文整理匯總了Java中javax.swing.SwingUtilities.convertMouseEvent方法的典型用法代碼示例。如果您正苦於以下問題:Java SwingUtilities.convertMouseEvent方法的具體用法?Java SwingUtilities.convertMouseEvent怎麽用?Java SwingUtilities.convertMouseEvent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.SwingUtilities的用法示例。


在下文中一共展示了SwingUtilities.convertMouseEvent方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: main

import javax.swing.SwingUtilities; //導入方法依賴的package包/類
public static void main(String[] args) {
    Frame frame = new Frame();
    Panel panel = new Panel();
    frame.add(panel);

    MouseWheelEvent event = new MouseWheelEvent(panel,
            0, 0, 0, 0, 0, 0, 0, 0, false, 0, 0,
            2, // wheelRotation
            PRECISE_WHEEL_ROTATION); // preciseWheelRotation

    MouseWheelEvent convertedEvent = (MouseWheelEvent) SwingUtilities.
            convertMouseEvent(event.getComponent(), event, null);

    if (convertedEvent.getPreciseWheelRotation() != PRECISE_WHEEL_ROTATION) {
        throw new RuntimeException("PreciseWheelRotation field is not copied!");
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:18,代碼來源:bug8049533.java

示例2: 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

示例3: redispatchMouseEvent

import javax.swing.SwingUtilities; //導入方法依賴的package包/類
public void redispatchMouseEvent(MouseEvent e) {
    if (!(e.getComponent() instanceof RenderedImage)) {
        return;
    }
    MouseEvent delegate = SwingUtilities.convertMouseEvent(e.getComponent(), e, listClasses);
    listClasses.dispatchEvent(delegate);
    // if the table started editing, remove the popup:
    if (listClasses.isEditing()) {
        hidePopup();
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:12,代碼來源:InnerPanelSupport.java

示例4: processMouseEvent

import javax.swing.SwingUtilities; //導入方法依賴的package包/類
public void processMouseEvent(MouseEvent e) {
    if (e instanceof MouseWheelEvent) {
        Component target = JCheckTree.this.getParent();
        if (target == null || !(target instanceof JViewport))
            target = JCheckTree.this;
        MouseEvent mwe = SwingUtilities.convertMouseEvent(
                JCheckTree.this, (MouseWheelEvent)e, target);
        target.dispatchEvent((MouseWheelEvent)mwe);
    } else {
        super.processMouseEvent((MouseEvent)e);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:13,代碼來源:JCheckTree.java

示例5: processMouseEvent

import javax.swing.SwingUtilities; //導入方法依賴的package包/類
public void processMouseEvent(MouseEvent e) {
    if (e instanceof MouseWheelEvent) {
        Component target = JExtendedTree.this.getParent();
        if (target == null || !(target instanceof JViewport))
            target = JExtendedTree.this;
        MouseEvent mwe = SwingUtilities.convertMouseEvent(
                JExtendedTree.this, (MouseWheelEvent)e, target);
        target.dispatchEvent((MouseWheelEvent)mwe);
    } else {
        super.processMouseEvent((MouseEvent)e);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:13,代碼來源:JExtendedTree.java

示例6: repostEvent

import javax.swing.SwingUtilities; //導入方法依賴的package包/類
private boolean repostEvent(MouseEvent e) {
	if (dispatchComponent == null) {
		return false;
	}
	MouseEvent e2 = SwingUtilities.convertMouseEvent(header, e, dispatchComponent);
	dispatchComponent.dispatchEvent(e2);
	return true;
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:9,代碼來源:EditableTableHeaderUI.java

示例7: eventDispatched

import javax.swing.SwingUtilities; //導入方法依賴的package包/類
public void eventDispatched(AWTEvent event) {
    if (event instanceof MouseEvent) {
        MouseEvent me = (MouseEvent) event;
        Component mecmp = me.getComponent();

        if (!SwingUtilities.isDescendingFrom(mecmp, (Component) rootPaneContainer)) {
            return;
        }
        if ((me.getID() == MouseEvent.MOUSE_EXITED) && (mecmp == rootPaneContainer)) {
            highcmp = null;
            point = null;
        } else {
            MouseEvent converted = SwingUtilities.convertMouseEvent(mecmp, me, this);
            point = converted.getPoint();
            Component parent = mecmp;
            Rectangle rect = new Rectangle();
            rect.width = mecmp.getWidth();
            rect.height = mecmp.getHeight();
            Rectangle parentBounds = new Rectangle();
            while ((parent != null) && (parent != this.getRootPane()) && (parent != rootPaneContainer)) {
                parent.getBounds(parentBounds);
                rect.x += parentBounds.x;
                rect.y += parentBounds.y;
                parent = parent.getParent();
            }
            highcmp = rect;
        }
        repaint();
    }
}
 
開發者ID:igr,項目名稱:swingspy,代碼行數:31,代碼來源:SwingSpyGlassPane.java

示例8: getToolTipText

import javax.swing.SwingUtilities; //導入方法依賴的package包/類
/**
 * Redirects the tooltip handling of the JComponent to the graph
 * component, which in turn may use getHandleToolTipText in this class to
 * find a tooltip associated with a handle.
 */
public String getToolTipText(MouseEvent e)
{
	MouseEvent tmp = SwingUtilities.convertMouseEvent(e.getComponent(), e,
			graphComponent.getGraphControl());
	Iterator<mxCellHandler> it = handlers.values().iterator();
	String tip = null;

	while (it.hasNext() && tip == null)
	{
		tip = it.next().getToolTipText(tmp);
	}

	return tip;
}
 
開發者ID:GDSRS,項目名稱:TrabalhoFinalEDA2,代碼行數:20,代碼來源:mxSelectionCellsHandler.java

示例9: getToolTipText

import javax.swing.SwingUtilities; //導入方法依賴的package包/類
/**
 * Redirects the tooltip handling of the JComponent to the graph component, which in turn may use
 * getHandleToolTipText in this class to find a tooltip associated with a handle.
 */
public String getToolTipText(MouseEvent e) {
  MouseEvent tmp =
      SwingUtilities.convertMouseEvent(e.getComponent(), e, graphComponent.getGraphControl());
  Iterator<mxCellHandler> it = handlers.values().iterator();
  String tip = null;

  while (it.hasNext() && tip == null) {
    tip = it.next().getToolTipText(tmp);
  }

  return tip;
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:17,代碼來源:mxSelectionCellsHandler.java

示例10: test

import javax.swing.SwingUtilities; //導入方法依賴的package包/類
private static void test(final Frame frame, final MouseEvent me) {
    MouseEvent newme = SwingUtilities.convertMouseEvent(frame, me, frame);
    if (me.getModifiersEx() != newme.getModifiersEx()
            || me.getModifiers() != newme.getModifiers()) {
        fail(me, newme);
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:8,代碼來源:bug7170657.java


注:本文中的javax.swing.SwingUtilities.convertMouseEvent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。