Example usage for java.awt.event MouseListener mouseClicked

List of usage examples for java.awt.event MouseListener mouseClicked

Introduction

In this page you can find the example usage for java.awt.event MouseListener mouseClicked.

Prototype

public void mouseClicked(MouseEvent e);

Source Link

Document

Invoked when the mouse button has been clicked (pressed and released) on a component.

Usage

From source file:com.mac.tarchan.desktop.event.EventQuery.java

/**
 * ?????//from  w  w w .  j  a v a2  s  .co m
 * 
 * @param mouseClicked ?
 * @return ??
 * @see MouseListener#mouseClicked(java.awt.event.MouseEvent)
 */
public EventQuery dblclick(final MouseListener mouseClicked) {
    log.debug("dblclick=" + list);
    for (Component child : list) {
        child.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                if (e.getClickCount() == 2)
                    mouseClicked.mouseClicked(e);
            }
        });
    }
    return this;
}

From source file:nl.xs4all.home.freekdb.b52reader.gui.MainGuiTest.java

private void testClickInTable(boolean firstStarred, boolean firstRead, boolean spanTable, boolean selectRow,
        int xMouseEvent) throws InterruptedException, InvocationTargetException {
    List<Article> testArticles = TestUtilities.getSixTestArticles();
    testArticles.get(0).setStarred(firstStarred);
    testArticles.get(0).setRead(firstRead);

    MainGui mainGui = new MainGui(mockManyBrowsersPanel);
    mainGui.setMainCallbacks(mockMainCallbacks);

    Mockito.when(mockConfiguration.useSpanTable()).thenReturn(spanTable);

    mainGui.initializeBackgroundBrowsersPanel(mockFrame, mockConfiguration);
    mainGui.initializeGui(testArticles);

    waitForGuiTasks();// w  w w . j ava 2 s .  com

    JTable table = (JTable) findComponent(mockContentPane, JTable.class);
    assertNotNull(table);

    if (selectRow) {
        table.getSelectionModel().setValueIsAdjusting(true);
        table.getSelectionModel().setSelectionInterval(1, 1);
        table.getSelectionModel().setValueIsAdjusting(true);
        table.getSelectionModel().setSelectionInterval(0, 0);
    } else {
        table.getSelectionModel().setValueIsAdjusting(true);
        table.clearSelection();
    }

    MouseEvent mouseEvent = new MouseEvent(table, 123456, new Date().getTime(), 0, xMouseEvent, 10, 1, false);

    for (MouseListener mouseListener : table.getMouseListeners()) {
        mouseListener.mouseClicked(mouseEvent);
    }
}