本文整理了Java中java.awt.event.MouseEvent.consume()
方法的一些代码示例,展示了MouseEvent.consume()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MouseEvent.consume()
方法的具体详情如下:
包路径:java.awt.event.MouseEvent
类名称:MouseEvent
方法名:consume
暂无
代码示例来源:origin: skylot/jadx
@Override
public void mouseClicked(MouseEvent evt) {
if (evt.getClickCount() % 2 == 0 && !evt.isConsumed()) {
evt.consume();
String str = getSelectedText();
if (str != null) {
highlightAllMatches(str);
}
} else {
highlightAllMatches(null);
}
}
});
代码示例来源:origin: runelite/runelite
@Override
public MouseEvent mouseClicked(MouseEvent event)
{
if (SwingUtilities.isMiddleMouseButton(event))
{
return event;
}
event.consume();
return event;
}
代码示例来源:origin: stanfordnlp/CoreNLP
@Override
public void mousePressed(MouseEvent e) {
if (MatchesPanel.getInstance().isEmpty()) return;
firstMouseEvent1 = e;
e.consume();
}
代码示例来源:origin: runelite/runelite
@Override
public MouseEvent mouseClicked(MouseEvent event)
{
if (!overlay.isMapShown() || isNotWithinOverlay(event.getPoint()))
{
return event;
}
event.consume();
return event;
}
代码示例来源:origin: stanfordnlp/CoreNLP
@Override
public void mouseDragged(MouseEvent e) {
if (MatchesPanel.getInstance().isEmpty()) return;
if (firstMouseEvent1 != null) {
e.consume();
int dx = Math.abs(e.getX() - firstMouseEvent1.getX());
int dy = Math.abs(e.getY() - firstMouseEvent1.getY());
//Arbitrarily define a 5-pixel shift as the
//official beginning of a drag.
if (dx > 5 || dy > 5) {
//This is a drag, not a click.
JComponent c = (JComponent)e.getSource();
//Tell the transfer handler to initiate the drag.
TransferHandler handler = c.getTransferHandler();
handler.exportAsDrag(c, firstMouseEvent1, TransferHandler.COPY);
firstMouseEvent1 = null;
}
}
}
代码示例来源:origin: stanfordnlp/CoreNLP
@Override
public void mouseDragged(MouseEvent e) {
if (MatchesPanel.getInstance().isEmpty()) return;
if (firstMouseEvent != null) {
e.consume();
if(dragNDrop) {
if(textField == null)
return;
if(Point2D.distanceSq(e.getX(), e.getY(), firstMouseEvent.getX(), firstMouseEvent.getY()) > 25) {
//do DnD
textField.getTransferHandler().exportAsDrag((JComponent) e.getSource(), firstMouseEvent, TransferHandler.COPY);
}
} else {
addHighlight(textField, firstMouseEvent, e);
}
}
}
}
代码示例来源:origin: stanfordnlp/CoreNLP
@Override
public void mouseDragged(MouseEvent e) {
if (MatchesPanel.getInstance().isEmpty()) return;
if (firstMouseEvent != null) {
e.consume();
JTextField label = ((TreeFromFile) list.getSelectedValue()).getLabel();
if(dragNDrop) {
if(label == null)
return;
if(Point2D.distanceSq(e.getX(), e.getY(), firstMouseEvent.getX(), firstMouseEvent.getY()) > 25) {
//do DnD
list.getTransferHandler().exportAsDrag((JComponent) e.getSource(), firstMouseEvent, TransferHandler.COPY);
}
} else {
addHighlight(label, firstMouseEvent, e);
}
}
}
代码示例来源:origin: wildfly/wildfly
public void mousePressed(MouseEvent e) {
Point p=e.getPoint();
double bestdist=Double.MAX_VALUE, dist;
int mod=e.getModifiers();
Node n;
if((mod & InputEvent.BUTTON3_MASK) != 0) {
System.out.println("\nright button at " + p);
n=findNodeAtPoint(p);
if(n != null) {
System.out.println("Found node at " + p + ": " + n);
new SendDialog(findParent(), n, myname, wb.disp);
repaint();
}
e.consume();
return;
}
for(int i=0; i < nodes.size(); i++) {
n=nodes.get(i);
dist=(n.x - p.x) * (n.x - p.x) + (n.y - p.y) * (n.y - p.y);
if(dist < bestdist) {
pick=n;
bestdist=dist;
}
}
pickfixed=pick.fixed;
pick.fixed=true;
pick.x=p.x;
pick.y=p.y;
repaint();
}
代码示例来源:origin: runelite/runelite
@Override
public MouseEvent mousePressed(MouseEvent event)
{
if (!overlay.isMapShown() || isNotWithinOverlay(event.getPoint()))
{
return event;
}
if (SwingUtilities.isLeftMouseButton(event) && isWithinCloseButton(event.getPoint()))
{
plugin.closeMap();
}
event.consume();
return event;
}
代码示例来源:origin: runelite/runelite
@Override
public MouseEvent mouseReleased(MouseEvent event)
{
if (SwingUtilities.isMiddleMouseButton(event))
{
return event;
}
if (SwingUtilities.isLeftMouseButton(event) && plugin.isCreatingScreenMarker())
{
/* Set the creation panel as "ready" (because the marker area as been drawn) */
plugin.completeSelection();
}
event.consume();
return event;
}
代码示例来源:origin: runelite/runelite
@Override
public MouseEvent mousePressed(MouseEvent event)
{
if (SwingUtilities.isMiddleMouseButton(event))
{
return event;
}
if (SwingUtilities.isLeftMouseButton(event))
{
plugin.startCreation(event.getPoint());
}
else if (plugin.isCreatingScreenMarker())
{
plugin.finishCreation(true);
}
event.consume();
return event;
}
代码示例来源:origin: runelite/runelite
e.consume();
return e;
e.consume();
return e;
e.consume();
return e;
e.consume();
return e;
代码示例来源:origin: runelite/runelite
@Override
public MouseEvent mouseClicked(MouseEvent e)
{
// Check if left click + alt
if (e.getButton() == MouseEvent.BUTTON1 && e.isAltDown())
{
final MenuEntry[] menuEntries = client.getMenuEntries();
for (final MenuEntry menuEntry : menuEntries)
{
if (menuEntry.getOption().equals(SEARCH_GRAND_EXCHANGE))
{
search(Text.removeTags(menuEntry.getTarget()));
e.consume();
break;
}
}
}
return super.mouseClicked(e);
}
代码示例来源:origin: runelite/runelite
@Override
public MouseEvent mouseDragged(MouseEvent mouseEvent)
{
if (!inOverlayDraggingMode)
{
return mouseEvent;
}
final Point mousePoint = mouseEvent.getPoint();
mousePosition.setLocation(mousePoint);
final Rectangle canvasRect = new Rectangle(client.getRealDimensions());
if (!canvasRect.contains(mousePoint))
{
return mouseEvent;
}
if (movedOverlay != null)
{
final Dimension realDimension = client.getRealDimensions();
mousePoint.translate(-overlayOffset.x, -overlayOffset.y);
mousePoint.x = Ints.constrainToRange(mousePoint.x, 0, realDimension.width - movedOverlay.getBounds().width);
mousePoint.y = Ints.constrainToRange(mousePoint.y, 0, realDimension.height - movedOverlay.getBounds().height);
movedOverlay.setPreferredPosition(null);
movedOverlay.setPreferredLocation(mousePoint);
mouseEvent.consume();
}
return mouseEvent;
}
代码示例来源:origin: stanfordnlp/CoreNLP
@Override
public void mousePressed(MouseEvent e) {
if (MatchesPanel.getInstance().isEmpty()) return;
if(firstMouseEvent == null) {
firstMouseEvent = e;
}
e.consume();
TreeFromFile selectedValue = (TreeFromFile) list.getSelectedValue();
if(selectedValue == null) return;
JTextField label = selectedValue.getLabel();
if(((e.getModifiersEx()) & InputEvent.SHIFT_DOWN_MASK) == InputEvent.SHIFT_DOWN_MASK) {
//shift is being held
addHighlight(label, firstMouseEvent, e);
} else if(!HighlightUtils.isInHighlight(e, label, label.getHighlighter())) {
label.getHighlighter().removeAllHighlights();
firstMouseEvent = e;
dragNDrop = false;
list.repaint();
} else {
//in a highlight, if we drag after this, we'll be DnDing
dragNDrop = true;
}
}
代码示例来源:origin: runelite/runelite
mouseEvent.consume();
代码示例来源:origin: stanfordnlp/CoreNLP
@Override
public void mousePressed(MouseEvent e) {
if (MatchesPanel.getInstance().isEmpty()) return;
if(firstMouseEvent == null) {
firstMouseEvent = e;
}
e.consume();
if(((e.getModifiersEx()) & InputEvent.SHIFT_DOWN_MASK) == InputEvent.SHIFT_DOWN_MASK) {
//shift is being held
addHighlight(textField, firstMouseEvent, e);
} else if(!HighlightUtils.isInHighlight(e, textField, textField.getHighlighter())) {
textField.getHighlighter().removeAllHighlights();
firstMouseEvent = e;
dragNDrop = false;
textField.repaint();
} else {
//in a highlight, if we drag after this, we'll be DnDing
dragNDrop = true;
}
}
代码示例来源:origin: runelite/runelite
mouseEvent.consume();
break;
代码示例来源:origin: magefree/mage
@Override
public void mousePressed(MouseEvent e) {
if ((e.getClickCount() & 1) == 0 && (e.getClickCount() > 0) && !e.isConsumed()) { // double clicks and repeated double clicks
e.consume();
if (e.isAltDown()) {
jButtonAddToSideboardActionPerformed(null);
} else {
jButtonAddToMainActionPerformed(null);
}
}
}
});
代码示例来源:origin: magefree/mage
@Override
public void mousePressed(MouseEvent e) {
if ((e.getClickCount() & 1) == 0 && (e.getClickCount() > 0) && !e.isConsumed()) { // double clicks and repeated double clicks
e.consume();
if (e.isAltDown()) {
handleAltDoubleClick();
} else {
handleDoubleClick();
}
}
}
});
内容来源于网络,如有侵权,请联系作者删除!