本文整理汇总了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!");
}
}
示例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;
}
}
示例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();
}
}
示例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);
}
}
示例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);
}
}
示例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;
}
示例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();
}
}
示例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;
}
示例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;
}
示例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);
}
}