List of usage examples for javax.swing JTable getMouseListeners
public synchronized MouseListener[] getMouseListeners()
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();//from w w w . ja va 2s . c o m 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); } }