当前位置: 首页>>代码示例>>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;未经允许,请勿转载。