Example usage for java.awt.event MouseEvent isConsumed

List of usage examples for java.awt.event MouseEvent isConsumed

Introduction

In this page you can find the example usage for java.awt.event MouseEvent isConsumed.

Prototype

public boolean isConsumed() 

Source Link

Document

Returns whether or not this event has been consumed.

Usage

From source file:Main.java

/**
 * Ignore mouse events if the component is null, not enabled, the event
 * is not associated with the left mouse button, or the event has been
 * consumed.//w ww .j a v  a2 s  .  co  m
 */
public static boolean shouldIgnore(MouseEvent me, JComponent c) {
    return c == null || !c.isEnabled() || !SwingUtilities.isLeftMouseButton(me) || me.isConsumed();
}

From source file:com.tag.MouseDragAndDrop.java

@Override
public final void mousePressed(MouseEvent e) {
    prepare(e);//w  w w .j  a v a  2s.  c  o  m
    if (e.isConsumed())
        return;

    startEvent = e;
}

From source file:Main.java

public void mouseMoved(MouseEvent e) {
    if (!rectangle.contains(e.getX(), e.getY()) || e.isConsumed()) {
        if (isActive) {
            isActive = false;/*from w ww . j a  va  2s .  c om*/
            repaint();
        }
        return; // quickly return, if outside our rectangle
    }

    int x = e.getX() - rectangle.x;
    int y = e.getY() - rectangle.y;
    boolean active = polygon.contains(x, y);

    if (isActive != active)
        setState(active);
    if (active)
        e.consume();
}

From source file:com.tag.MouseDragAndDrop.java

@Override
public final void mouseDragged(MouseEvent e) {
    prepare(e);/*from   w  w w.j a  v a2  s  . c o  m*/
    if (e.isConsumed())
        return;

    if (dragEvent == null)
        selected(startEvent);

    dragEvent = e;
    dragged(e);
}

From source file:net.andydvorak.intellij.lessc.ui.configurable.LessProfileConfigurableForm.java

public JComponent createOptionsPanel() {
    lessDirTextField = new TextFieldWithBrowseButtonImpl(project, UIBundle.message("file.chooser.less.title"));

    lessDirPanel.add(lessDirTextField, GRIDCONSTRAINTS_FILL_ALL);

    profileMappingTable.addMouseListener(new MouseListener() {
        @Override/*from  w w  w  .ja  v a  2  s  .c o  m*/
        public void mouseClicked(MouseEvent mouseEvent) {
            if (mouseEvent.getClickCount() == 2 && !mouseEvent.isConsumed()) {
                mouseEvent.consume();
                editRow();
            }
        }

        @Override
        public void mousePressed(MouseEvent mouseEvent) {
        }

        @Override
        public void mouseReleased(MouseEvent mouseEvent) {
        }

        @Override
        public void mouseEntered(MouseEvent mouseEvent) {
        }

        @Override
        public void mouseExited(MouseEvent mouseEvent) {
        }
    });

    final ToolbarDecorator decorator = ToolbarDecorator.createDecorator(profileMappingTable);
    decorator.setAddAction(new AnActionButtonRunnable() {
        @Override
        public void run(AnActionButton button) {
            addRow();
        }
    }).setEditAction(new AnActionButtonRunnable() {
        @Override
        public void run(AnActionButton button) {
            editRow();
        }
    }).disableUpDownActions();

    cssDirPanel.add(decorator.createPanel(), GRIDCONSTRAINTS_FILL_ALL);

    resetPromptsButton.setMnemonic('r');
    resetPromptsButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            lessManager.getState().resetPrompts();
            lessProfilesPanel.setPromptButtonsEnabled(false);
        }
    });
    resetPromptsButton.setEnabled(!lessManager.getState().hasDefaultPromptSettings());

    return rootPanel;
}

From source file:br.com.utfpr.pb.view.CaixasView.java

private void jTableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTableMouseClicked
    // TODO add your handling code here:
    tableEvent();/*from   ww  w . j  av a  2s  .  c  om*/
    if (evt.getClickCount() == 2 && !evt.isConsumed()) {
        evt.consume();
        //handle double click event.
        openModal();
    }

}

From source file:br.com.utfpr.pb.view.PedidoCompraView.java

private void jTableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTableMouseClicked
    // TODO add your handling code here:
    tableEvent();//from   w ww . ja  va2  s  . c  om
    if (evt.getClickCount() == 2 && !evt.isConsumed()) {
        evt.consume();
        //handle double click event.
        openModal();
    }
}

From source file:com.limegroup.gnutella.gui.search.ResultPanel.java

/**
 * Sets extra values for non dummy ResultPanels.
 * (Used for all tables that will have results.)
 *
 * Currently://from w  w  w .  j av  a2s. c  om
 * - Sorts the count column, if it is visible & real-time sorting is on.
 * - Adds listeners, so the filters can be displayed when necessary.
 */
private void setupRealTable() {
    SearchTableColumns columns = ((ResultPanelModel) DATA_MODEL).getColumns();
    LimeTableColumn countColumn = columns.getColumn(SearchTableColumns.COUNT_IDX);
    if (SETTINGS.REAL_TIME_SORT.getValue() && TABLE.isColumnVisible(countColumn.getId())) {
        DATA_MODEL.sort(SearchTableColumns.COUNT_IDX); // ascending
        DATA_MODEL.sort(SearchTableColumns.COUNT_IDX); // descending
    }

    MouseListener filterDisplayer = new MouseListener() {
        public void mouseClicked(MouseEvent e) {
            if (e.isConsumed())
                return;
            e.consume();
            SearchMediator.panelSelected(ResultPanel.this);
        }

        public void mousePressed(MouseEvent e) {
        }

        public void mouseReleased(MouseEvent e) {
        }

        public void mouseEntered(MouseEvent e) {
        }

        public void mouseExited(MouseEvent e) {
        }
    };
    // catches around the button area.
    MAIN_PANEL.addMouseListener(filterDisplayer);
    // catches the blank area before results fill in
    SCROLL_PANE.addMouseListener(filterDisplayer);
    // catches selections on the table
    TABLE.addMouseListener(filterDisplayer);
    // catches the table header
    TABLE.getTableHeader().addMouseListener(filterDisplayer);
}

From source file:forge.itemmanager.views.ItemListView.java

/**
 * ItemTable Constructor./*from  w  w  w  . j av a 2s  . c  o m*/
 *
 * @param itemManager0
 * @param model0
 */
public ItemListView(final ItemManager<T> itemManager0, final ItemManagerModel<T> model0) {
    super(itemManager0, model0);
    this.tableModel = new ItemTableModel(model0);
    this.setAllowMultipleSelections(false);
    this.getPnlOptions().setVisible(false); //hide options panel by default

    // use different selection highlight colors for focused vs. unfocused tables
    this.table.addMouseListener(new FMouseAdapter() {
        @Override
        public void onLeftDoubleClick(final MouseEvent e) {
            if (e.isConsumed()) {
                return;
            } //don't activate if inline button double clicked

            final int clickedIndex = table.rowAtPoint(e.getPoint());

            itemManager.activateSelectedItems();

            if (clickedIndex >= table.getRowCount()) {
                FMouseAdapter.forceMouseUp(); //prevent mouse getting stuck if final row removed from double click handling
            }
        }

        @Override
        public void onRightClick(final MouseEvent e) {
            itemManager.showContextMenu(e);
        }
    });

    // prevent tables from intercepting tab focus traversals
    this.table.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, null);
    this.table.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, null);
}

From source file:net.sf.mzmine.chartbasics.gui.swing.ChartGestureMouseAdapter.java

@Override
public void mouseClicked(MouseEvent e) {
    if (gestureHandlers == null || gestureHandlers.isEmpty()
            || !(listensFor(Event.CLICK) || listensFor(Event.DOUBLE_CLICK)))
        return;//ww  w.j a  v a 2s  .co m

    if (e.getComponent() instanceof ChartPanel) {
        ChartPanel chartPanel = (ChartPanel) e.getComponent();
        ChartEntity entity = findChartEntity(chartPanel, e);
        ChartGesture.Entity gestureEntity = ChartGesture.getGestureEntity(entity);
        Button button = Button.getButton(e.getButton());

        if (!e.isConsumed()) {
            // double clicked
            if (e.getClickCount() == 2) {
                // reset click count to handle double clicks quickly
                e.consume();
                // handle event
                handleEvent(new ChartGestureEvent(chartPanel, e, entity,
                        new ChartGesture(gestureEntity, Event.DOUBLE_CLICK, button)));
            } else if (e.getClickCount() == 1) {
                // handle event
                handleEvent(new ChartGestureEvent(chartPanel, e, entity,
                        new ChartGesture(gestureEntity, Event.CLICK, button)));
            }
        }
    }
}