本文整理汇总了Java中java.awt.event.MouseEvent.consume方法的典型用法代码示例。如果您正苦于以下问题:Java MouseEvent.consume方法的具体用法?Java MouseEvent.consume怎么用?Java MouseEvent.consume使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.event.MouseEvent
的用法示例。
在下文中一共展示了MouseEvent.consume方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mouseReleased
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
/**
*
*/
public void mouseReleased(MouseEvent e)
{
if (!e.isConsumed() && start != null)
{
int dx = Math.abs(start.x - e.getX());
int dy = Math.abs(start.y - e.getY());
if (graphComponent.isSignificant(dx, dy))
{
e.consume();
}
}
start = null;
}
示例2: mouseMoved
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mouseMoved(MouseEvent e) {
if(graphics!=null){
float spacer = LayerUtilities.pixelsToUnits(graphics, 20, false);
float heightOfABlock = LayerUtilities.pixelsToUnits(graphics, 30, false);
int verticalOffsetOffset = -1 * (Math.round((index + 1) * spacer + index * heightOfABlock));
int startHeight = verticalOffsetOffset ;
int stopHeight = verticalOffsetOffset + Math.round(heightOfABlock);
Point2D pointInUnits = LayerUtilities.pixelsToUnits(graphics, e.getX(), e.getY());
int startTime = Math.round(guessedStartTimeOfStream);
int stopTime = Math.round(guessedStartTimeOfStream+streamDuration);
if(pointInUnits.getX() >= startTime && pointInUnits.getX() <= stopTime && pointInUnits.getY() >= startHeight && pointInUnits.getY() <= stopHeight){
((JComponent)(e.getSource())).setCursor(new Cursor(Cursor.HAND_CURSOR));
e.consume();
}
}
}
示例3: mouseClickedOnItem
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
private void mouseClickedOnItem(MouseEvent e) {
if (SwingUtilities.isRightMouseButton(e)) {
e.consume();
if (isSelected()) {
Iterator<Category> iterator = evalCats.iterator();
while (iterator.hasNext()) {
Category c = iterator.next();
if (!CommandEvaluator.RECENT.equals(c.getName())) {
iterator.remove();
}
}
evalCats.add(category);
} else {
evalCats.addAll(
ProviderModel.getInstance().getCategories());
evalCats.remove(category);
}
updateCheckBoxes(CategoryCheckBoxMenuItem.this, evalCats);
updateCats(evalCats);
}
}
示例4: handleDrag
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void handleDrag(MouseEvent e) {
if (firstPort != null) {
if (!e.isConsumed()) {
Graphics2D g = mediator.getGraphGraphics();
Color bg = mediator.getGraphBackground();
Color fg = Color.BLACK;
g.setColor(fg);
g.setXORMode(bg);
overlay(g);
current = mediator.snap(e.getPoint());
port = getInPortViewAt(e.getX(), e.getY());
if (port != null) {
current = mediator.toScreen(port.getLocation(null));
}
g.setColor(bg);
g.setXORMode(fg);
overlay(g);
e.consume();
}
}
}
示例5: mousePressed
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
/**
*
*/
public void mousePressed(MouseEvent e) {
if (graphComponent.isEnabled() && isEnabled() && !e.isConsumed()
&& !graphComponent.isForceMarqueeEvent(e)) {
cell = graphComponent.getCellAt(e.getX(), e.getY(), false);
initialCell = cell;
if (cell != null) {
if (isSelectEnabled() && !graphComponent.getGraph().isCellSelected(cell)) {
graphComponent.selectCellForEvent(cell, e);
cell = null;
}
// Starts move if the cell under the mouse is movable and/or any
// cells of the selection are movable
if (isMoveEnabled() && !e.isPopupTrigger()) {
start(e);
e.consume();
}
} else if (e.isPopupTrigger()) {
graphComponent.getGraph().clearSelection();
}
}
}
示例6: mouseMoved
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
/**
*
*/
public void mouseMoved(MouseEvent e)
{
if (graphComponent.isEnabled() && isEnabled() && !e.isConsumed())
{
Cursor cursor = getCursor(e);
if (cursor != null)
{
graphComponent.getGraphControl().setCursor(cursor);
e.consume();
}
else
{
graphComponent.getGraphControl().setCursor(DEFAULT_CURSOR);
}
}
}
示例7: mouseReleased
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
/**
*
*/
public void mouseReleased(MouseEvent e)
{
if (!e.isConsumed() && first != null)
{
if (preview != null && preview.isVisible())
{
if (isLabel(index))
{
moveLabel(e);
}
else
{
resizeCell(e);
}
}
e.consume();
}
super.mouseReleased(e);
}
示例8: performCommand
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
private void performCommand (String command, int idx, MouseEvent evt) {
evt.consume();
if (TabDisplayer.COMMAND_SELECT == command) {
if (idx != displayer.getSelectionModel().getSelectedIndex()) {
boolean go = shouldPerformAction (command, idx, evt);
if (go) {
selectionModel.setSelectedIndex (idx);
}
}
} else {
boolean should = shouldPerformAction (command, idx, evt) && displayer.isShowCloseButton();
if (should) {
if (TabDisplayer.COMMAND_CLOSE == command) {
displayer.getModel().removeTab(idx);
} else if (TabDisplayer.COMMAND_CLOSE_ALL == command) {
displayer.getModel().removeTabs (0, displayer.getModel().size());
} else if (TabDisplayer.COMMAND_CLOSE_ALL_BUT_THIS == command) {
int start;
int end;
if (idx != displayer.getModel().size()-1) {
start = idx+1;
end = displayer.getModel().size();
displayer.getModel().removeTabs(start, end);
}
if (idx != 0) {
start = 0;
end = idx;
displayer.getModel().removeTabs(start, end);
}
}
}
}
}
示例9: mousePressed
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
/**
*
*/
public void mousePressed(MouseEvent e) {
if (!e.isConsumed() && isEnabled() && isRubberbandTrigger(e) && !e.isPopupTrigger()) {
start(e.getPoint());
e.consume();
}
}
示例10: showGraphPopupMenu
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
/**
*
*/
protected void showGraphPopupMenu(MouseEvent e)
{
Point pt = SwingUtilities.convertPoint(e.getComponent(), e.getPoint(),
graphComponent);
EditorPopupMenu menu = new EditorPopupMenu(BasicGraphEditor.this);
menu.show(graphComponent, pt.x, pt.y);
e.consume();
}
示例11: maybePopup
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
private void maybePopup( MouseEvent e ) {
if( e.isPopupTrigger() ) {
e.consume();
int row = rowAtPoint( e.getPoint() );
if( row >= 0 )
getSelectionModel().setSelectionInterval( row, row );
JPopupMenu popup = Util.createPopup( this );
popup.show( this, e.getX(), e.getY() );
}
}
示例12: mouseDragged
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
/**
*
*/
public void mouseDragged(MouseEvent e)
{
if (!e.isConsumed() && graphComponent.isEnabled() && isEnabled())
{
// Activates the handler
if (!active && first != null)
{
double dx = Math.abs(first.getX() - e.getX());
double dy = Math.abs(first.getY() - e.getY());
int tol = graphComponent.getTolerance();
if (dx > tol || dy > tol)
{
active = true;
}
}
if (e.getButton() == 0 || (isActive() && connectPreview.isActive()))
{
mxCellState state = marker.process(e);
if (connectPreview.isActive())
{
connectPreview.update(e, marker.getValidState(), e.getX(),
e.getY());
setBounds(null);
e.consume();
}
else
{
source = state;
}
}
}
}
示例13: mousePressed
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public synchronized void mousePressed(MouseEvent e) {
e.consume();
threadSuspended = !threadSuspended;
if (!threadSuspended) {
notify();
}
}
示例14: mouseMoved
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mouseMoved(MouseEvent e) {
e.consume();
changeSelection(e);
pTable.onMouseEvent(e);
isDragging = false;
}
示例15: mouseReleased
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mouseReleased(MouseEvent e) {
if (e.isPopupTrigger()) {
popup.show(e.getComponent(), e.getX(), e.getY());
e.consume();
} else {
if (mouseDraggingX != -1 && mouseDraggingY != -1) {
mouseDraggingX = -1;
mouseDraggingY = -1;
if (base.dimension == 2) {
if (Math.abs(e.getX() - mouseClickX) > 20 && Math.abs(e.getY() - mouseClickY) > 20) {
double[] sc1 = ((Projection2D) (graphics.projection)).inverseProjection(mouseClickX, mouseClickY);
double[] sc2 = ((Projection2D) (graphics.projection)).inverseProjection(e.getX(), e.getY());
if (Math.min(sc1[0], sc2[0]) < base.upperBound[0]
&& Math.max(sc1[0], sc2[0]) > base.lowerBound[0]
&& Math.min(sc1[1], sc2[1]) < base.upperBound[1]
&& Math.max(sc1[1], sc2[1]) > base.lowerBound[1]) {
base.lowerBound[0] = Math.max(base.lowerBound[0], Math.min(sc1[0], sc2[0]));
base.upperBound[0] = Math.min(base.upperBound[0], Math.max(sc1[0], sc2[0]));
base.lowerBound[1] = Math.max(base.lowerBound[1], Math.min(sc1[1], sc2[1]));
base.upperBound[1] = Math.min(base.upperBound[1], Math.max(sc1[1], sc2[1]));
for (int i = 0; i < base.dimension; i++) {
base.setPrecisionUnit(i);
}
base.initBaseCoord();
graphics.projection.reset();
baseGrid.setBase(base);
}
}
}
repaint();
e.consume();
}
}
}