List of usage examples for java.awt.event MouseEvent getSource
public Object getSource()
From source file:corelyzer.ui.CorelyzerApp.java
public void mouseClicked(final MouseEvent e) { if (e.getClickCount() == 2) { // double clicks Object actionSource = e.getSource(); if (actionSource.equals(sectionList)) { int selectedTrackIdx = trackList.getSelectedIndex(); int selectedSectionIdx = sectionList.getSelectedIndex(); if ((selectedTrackIdx < 0) || (selectedSectionIdx < 0)) { // System.out.println("" + selectedTrackIdx + ", " // + selectedSectionIdx); return; }/*w ww.j a v a2 s . c o m*/ CRDefaultListModel trackListModel = getTrackListModel(); CRDefaultListModel sectionsListModel = getSectionListModel(); if ((trackListModel.getSize() == 0) || (sectionsListModel.getSize() == 0)) { System.out.println("0 list models"); return; } TrackSceneNode t = (TrackSceneNode) trackListModel.getElementAt(selectedTrackIdx); String secname = ((CoreSection) sectionsListModel.getElementAt(selectedSectionIdx)).getName(); if (t == null) { System.out.println("- Null track list selection"); return; } CoreSection cs = t.getCoreSection(secname); if (cs == null) { System.out.println("- Null CoreSection list section"); return; } CRExperimentController.locateSection(t.getId(), cs.getId()); } else if (actionSource.equals(trackList)) { // if it's track, move to track's Y-pos TrackSceneNode t = (TrackSceneNode) trackList.getSelectedValue(); if (t != null) { int nativeTrackId = t.getId(); if (nativeTrackId < 0) { return; } float posX; float posY; SceneGraph.lock(); { if (SceneGraph.getDepthOrientation()) { posX = SceneGraph.getSceneCenterX(); posY = SceneGraph.getTrackYPos(nativeTrackId); } else { posX = -SceneGraph.getTrackYPos(nativeTrackId); posY = SceneGraph.getSceneCenterY(); } SceneGraph.positionScene(posX, posY); } SceneGraph.unlock(); updateGLWindows(); } } } }
From source file:de.tor.tribes.ui.views.DSWorkbenchFarmManager.java
private void fireCloseFarmSearchEvent(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_fireCloseFarmSearchEvent if (evt.getSource() == jSearchButton) { int added = 0; if (jByCenter.isSelected()) { added = FarmManager.getSingleton().findFarmsFromBarbarians(coordSpinner.getValue(), UIHelper.parseIntFromField(jRangeField, 20)); } else if (jByVillage.isSelected()) { added = FarmManager.getSingleton() .findFarmsFromBarbarians(UIHelper.parseIntFromField(jRangeField, 20)); } else if (jByVillageCenter.isSelected()) { Tribe yourTribe = GlobalOptions.getSelectedProfile().getTribe(); Point center = DSCalculator.calculateCenterOfMass(Arrays.asList(yourTribe.getVillageList())); added = FarmManager.getSingleton().findFarmsFromBarbarians(center, UIHelper.parseIntFromField(jRangeField, 20)); } else if (jByCurrent.isSelected()) { added = FarmManager.getSingleton().findFarmsFromBarbarians( DSWorkbenchMainFrame.getSingleton().getCurrentUserVillage().getPosition(), UIHelper.parseIntFromField(jRangeField, 20)); }/*from w w w.jav a2 s . co m*/ if (added == 0) { showInfo("Keine neuen Farmen gefunden"); } else { showInfo(added + " Farmen hinzugefgt"); } } jFarmFromBarbarianSelectionDialog.setVisible(false); }
From source file:ro.nextreports.designer.querybuilder.DBBrowserTree.java
private void selectionTableOrView(DBBrowserNode selectedNode, MouseEvent e) { boolean isTable = true; if (selectedNode.getDBObject().getType() == DBObject.VIEW) { isTable = false;/*from ww w . j av a 2 s .c om*/ } ViewTableColumnsInfoAction infoAction = new ViewTableColumnsInfoAction(selectedNode.getDBObject(), isTable); if (e.getClickCount() == 2) { infoAction.actionPerformed(null); } else { JPopupMenu popupMenu = new JPopupMenu(); JMenuItem menuItem = new JMenuItem(infoAction); popupMenu.add(menuItem); popupMenu.show((Component) e.getSource(), e.getX(), e.getY()); } }
From source file:ro.nextreports.designer.querybuilder.DBBrowserTree.java
private void selectionProcedure(DBBrowserNode selectedNode, MouseEvent e) { ViewProcedureColumnsInfoAction infoAction = new ViewProcedureColumnsInfoAction(selectedNode.getDBObject()); if (e.getClickCount() == 2) { infoAction.actionPerformed(null); } else {/*from w w w . jav a 2s. c om*/ JPopupMenu popupMenu = new JPopupMenu(); JMenuItem menuItem = new JMenuItem(infoAction); popupMenu.add(menuItem); JMenuItem menuItem2 = new JMenuItem(new ValidateProceduresAction(selectedNode.getDBObject())); popupMenu.add(menuItem2); popupMenu.show((Component) e.getSource(), e.getX(), e.getY()); } }
From source file:org.fhaes.gui.AnalysisResultsPanel.java
/** * Set up the AnalysisResults GUI//from w w w .j av a2s.c o m */ private void initGUI() { setLayout(new BorderLayout(0, 0)); if (Platform.isOSX()) setBackground(MainWindow.MAC_BACKGROUND_COLOR); ImageIcon iconMultipleTables = Builder.getImageIcon("multipletables16.png"); ImageIcon iconTable = Builder.getImageIcon("table16.png"); // ImageIcon iconChart = Builder.getImageIcon("chart16.png"); // Categories rootNode = new FHAESCategoryTreeNode("FHAES analysis results"); categoryGeneral = new FHAESCategoryTreeNode("Descriptive summaries", Builder.getImageIcon("interval16.png")); categoryInterval = new FHAESCategoryTreeNode("Interval analysis", Builder.getImageIcon("interval16.png")); categorySeasonality = new FHAESCategoryTreeNode("Seasonality", Builder.getImageIcon("seasonality16.png")); categoryBinarySummaryMatrices = new FHAESCategoryTreeNode("Binary summary matrices", Builder.getImageIcon("matrix16.png")); categoryBinaryMatrices = new FHAESCategoryTreeNode("Binary comparison matrices", Builder.getImageIcon("matrix16.png")); categorySimMatrices = new FHAESCategoryTreeNode("Similarity matrices", Builder.getImageIcon("matrix16.png")); categoryDisSimMatrices = new FHAESCategoryTreeNode("Dissimilarity matrices", Builder.getImageIcon("matrix16.png")); // Menu actions // Results itemJaccard = new FHAESResultTreeNode(FHAESResult.JACCARD_SIMILARITY_MATRIX, iconMultipleTables); itemJaccard.addAction(new FHAESAction("Save to CSV", "formatcsv.png") { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent event) { saveFileToDisk(SJACFile, new CSVFileFilter()); } }); itemCohen = new FHAESResultTreeNode(FHAESResult.COHEN_SIMILARITITY_MATRIX, iconMultipleTables); itemCohen.addAction(new FHAESAction("Save to CSV", "formatcsv.png") { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent event) { saveFileToDisk(SCOHFile, new CSVFileFilter()); } }); itemJaccardD = new FHAESResultTreeNode(FHAESResult.JACCARD_SIMILARITY_MATRIX_D, iconMultipleTables); itemJaccardD.addAction(new FHAESAction("Save to CSV", "formatcsv.png") { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent event) { saveFileToDisk(DSJACFile, new CSVFileFilter()); } }); itemCohenD = new FHAESResultTreeNode(FHAESResult.COHEN_SIMILARITITY_MATRIX_D, iconMultipleTables); itemCohenD.addAction(new FHAESAction("Save to CSV", "formatcsv.png") { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent event) { saveFileToDisk(DSCOHFile, new CSVFileFilter()); } }); itemIntervalSummary = new FHAESResultTreeNode(FHAESResult.INTERVAL_SUMMARY, iconMultipleTables); itemIntervalSummary.addAction(new FHAESAction("Save to CSV", "formatcsv.png") { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent event) { saveFileToDisk(intervalsSummaryFile, new CSVFileFilter()); } }); itemExceedence = new FHAESResultTreeNode(FHAESResult.INTERVAL_EXCEEDENCE_TABLE, iconMultipleTables); itemExceedence.addAction(new FHAESAction("Save to CSV", "formatcsv.png") { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent event) { saveFileToDisk(intervalsExceedenceFile, new CSVFileFilter()); } }); itemSeasonalitySummary = new FHAESResultTreeNode(FHAESResult.SEASONALITY_SUMMARY, iconMultipleTables); itemSeasonalitySummary.addAction(new FHAESAction("Save to CSV", "formatcsv.png") { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent event) { saveFileToDisk(seasonalitySummaryFile, new CSVFileFilter()); } }); itemBin00 = new FHAESResultTreeNode(FHAESResult.BINARY_MATRIX_00, iconMultipleTables); itemBin00.addAction(new FHAESAction("Save to CSV", "formatcsv.png") { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent event) { saveFileToDisk(bin00File, new CSVFileFilter()); } }); itemBin01 = new FHAESResultTreeNode(FHAESResult.BINARY_MATRIX_01, iconMultipleTables); itemBin01.addAction(new FHAESAction("Save to CSV", "formatcsv.png") { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent event) { saveFileToDisk(bin01File, new CSVFileFilter()); } }); itemBin10 = new FHAESResultTreeNode(FHAESResult.BINARY_MATRIX_10, iconMultipleTables); itemBin10.addAction(new FHAESAction("Save to CSV", "formatcsv.png") { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent event) { saveFileToDisk(bin10File, new CSVFileFilter()); } }); itemBin11 = new FHAESResultTreeNode(FHAESResult.BINARY_MATRIX_11, iconMultipleTables); itemBin11.addAction(new FHAESAction("Save to CSV", "formatcsv.png") { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent event) { saveFileToDisk(bin11File, new CSVFileFilter()); } }); itemBinSum = new FHAESResultTreeNode(FHAESResult.BINARY_MATRIX_SUM, iconMultipleTables); itemBinSum.addAction(new FHAESAction("Save to CSV", "formatcsv.png") { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent event) { saveFileToDisk(binSumFile, new CSVFileFilter()); } }); itemBinSiteSummary = new FHAESResultTreeNode(FHAESResult.BINARY_MATRIX_SITE, iconMultipleTables); itemBinSiteSummary.addAction(new FHAESAction("Save to CSV", "formatcsv.png") { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent event) { saveFileToDisk(siteSummaryFile, new CSVFileFilter()); } }); itemBinSiteSummary.addAction(new FHAESAction("Export to shapefile", "formatshp.png") { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent event) { new ShapeFileDialog(App.mainFrame, fhm); } }); itemBinTreeSummary = new FHAESResultTreeNode(FHAESResult.BINARY_MATRIX_TREE, iconMultipleTables); itemBinTreeSummary.addAction(new FHAESAction("Save to CSV", "formatcsv.png") { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent event) { saveFileToDisk(treeSummaryFile, new CSVFileFilter()); } }); itemNTP = new FHAESResultTreeNode(FHAESResult.BINARY_MATRIX_NTP, iconMultipleTables); itemNTP.addAction(new FHAESAction("Save to CSV", "formatcsv.png") { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent event) { saveFileToDisk(NTPFile, new CSVFileFilter()); } }); this.itemGeneralSummary = new FHAESResultTreeNode(FHAESResult.GENERAL_SUMMARY, iconMultipleTables); itemGeneralSummary.addAction(new FHAESAction("Save to CSV", "formatcsv.png") { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent event) { saveFileToDisk(generalSummaryFile, new CSVFileFilter()); } }); this.itemSingleFileSummary = new FHAESResultTreeNode(FHAESResult.SINGLE_FILE_SUMMARY, iconTable); itemSingleFileSummary.addAction(new FHAESAction("Save to CSV", "formatcsv.png") { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent event) { saveFileToDisk(singleFileSummaryFile, new CSVFileFilter()); } }); this.itemSingleEventSummary = new FHAESResultTreeNode(FHAESResult.SINGLE_EVENT_SUMMARY, iconTable); itemSingleEventSummary.addAction(new FHAESAction("Save to CSV", "formatcsv.png") { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent event) { saveFileToDisk(singleEventSummaryFile, new CSVFileFilter()); } }); // Add results to categories categoryGeneral.add(itemGeneralSummary); categoryGeneral.add(itemSingleFileSummary); categoryGeneral.add(itemSingleEventSummary); categorySimMatrices.add(itemJaccard); categorySimMatrices.add(itemCohen); categoryDisSimMatrices.add(itemJaccardD); categoryDisSimMatrices.add(itemCohenD); categoryInterval.add(itemIntervalSummary); categoryInterval.add(itemExceedence); categorySeasonality.add(itemSeasonalitySummary); categoryBinaryMatrices.add(itemBin11); categoryBinaryMatrices.add(itemBin01); categoryBinaryMatrices.add(itemBin10); categoryBinaryMatrices.add(itemBin00); categoryBinaryMatrices.add(itemBinSum); categoryBinarySummaryMatrices.add(itemBinSiteSummary); categoryBinarySummaryMatrices.add(itemBinTreeSummary); categoryBinarySummaryMatrices.add(itemNTP); // Add categories to root of tree rootNode.add(categoryGeneral); rootNode.add(categoryInterval); rootNode.add(categorySeasonality); rootNode.add(categoryBinarySummaryMatrices); rootNode.add(categoryBinaryMatrices); rootNode.add(categorySimMatrices); rootNode.add(categoryDisSimMatrices); treeModel = new DefaultTreeModel(rootNode); splitPane = new JSplitPane(); if (Platform.isOSX()) splitPane.setBackground(MainWindow.MAC_BACKGROUND_COLOR); splitPane.setResizeWeight(0.9); add(splitPane, BorderLayout.CENTER); JPanel panelTree = new JPanel(); splitPane.setRightComponent(panelTree); panelTree.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null)); panelTree.setLayout(new BorderLayout(0, 0)); // Build tree treeResults = new JTree(); panelTree.add(treeResults); treeResults.setModel(treeModel); treeResults.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); treeResults.setCellRenderer(new FHAESResultTreeRenderer()); pickResultPanel = new PickResultPanel(); runAnalysisPanel = new RunAnalysisPanel(); cards = new JPanel(); cl = new CardLayout(); cards.setLayout(cl); cards.add(pickResultPanel, PICKRESULTPANEL); cards.add(runAnalysisPanel, RUNANALYSIS); cards.add(emptyPanel, EMPTYPANEL); splitPane.setLeftComponent(cards); cl.show(cards, RUNANALYSIS); splitPaneResult = new JSplitPane(); splitPaneResult.setOneTouchExpandable(true); splitPaneResult.setOrientation(JSplitPane.VERTICAL_SPLIT); cards.add(splitPaneResult, RESULTSPANEL); panelResult = new JPanel(); panelResult.setBorder(new TitledBorder(null, "", TitledBorder.LEADING, TitledBorder.TOP, null, null)); panelResult.setLayout(new BorderLayout(0, 0)); goldFishPanel = new GoldFishPanel(); splitPaneResult.setRightComponent(goldFishPanel); // Build table scrollPane = new JScrollPane(); panelResult.add(scrollPane); table = new JXTable(); adapter = new JTableSpreadsheetByRowAdapter(table); table.setModel(new DefaultTableModel()); table.setHorizontalScrollEnabled(true); scrollPane.setViewportView(table); splitPaneResult.setLeftComponent(panelResult); // OSX Style hack if (Platform.isOSX()) panelResult.setBackground(MainWindow.MAC_BACKGROUND_COLOR); if (Platform.isOSX()) scrollPane.setBackground(MainWindow.MAC_BACKGROUND_COLOR); // Expand all nodes for (int i = 0; i < treeResults.getRowCount(); i++) { treeResults.expandRow(i); } treeResults.addTreeSelectionListener(this); treeResults.addMouseListener(new MouseListener() { @Override public void mouseClicked(MouseEvent e) { if (SwingUtilities.isRightMouseButton(e)) { int x = e.getX(); int y = e.getY(); JTree tree = (JTree) e.getSource(); TreePath path = tree.getPathForLocation(x, y); if (path == null) return; if (!tree.isEnabled()) return; tree.setSelectionPath(path); Component mc = e.getComponent(); if (path != null && path.getLastPathComponent() instanceof FHAESResultTreeNode) { FHAESResultTreeNode node = (FHAESResultTreeNode) path.getLastPathComponent(); if (!node.isEnabled()) return; FHAESResultPopupMenu popupMenu = new FHAESResultPopupMenu(node.getArrayOfActions()); popupMenu.show(mc, e.getX(), e.getY()); } } } @Override public void mouseEntered(MouseEvent arg0) { } @Override public void mouseExited(MouseEvent arg0) { } @Override public void mousePressed(MouseEvent arg0) { } @Override public void mouseReleased(MouseEvent arg0) { } }); this.splitPaneResult.setDividerLocation(10000); this.splitPaneResult.setDividerSize(3); this.splitPaneResult.setResizeWeight(1); }
From source file:ro.nextreports.designer.querybuilder.DBBrowserTree.java
private void selectionQueryGroup(DBBrowserNode selectedNode, MouseEvent e) { if (e.getClickCount() == 2) { return;//from w w w . ja v a 2 s . com } ImportQueryAction importAction = new ImportQueryAction(); JPopupMenu popupMenu = new JPopupMenu(); JMenuItem menuItem = new JMenuItem(importAction); popupMenu.add(menuItem); JMenuItem menuItem2 = new JMenuItem(new AddFolderAction(this, selectedNode, DBObject.FOLDER_QUERY)); popupMenu.add(menuItem2); JMenuItem menuItem3 = new JMenuItem(new ValidateSqlsAction(selectedNode.getDBObject())); popupMenu.add(menuItem3); popupMenu.show((Component) e.getSource(), e.getX(), e.getY()); }
From source file:CSSDFarm.UserInterface.java
private void sliderServerOnOffMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_sliderServerOnOffMouseReleased JSlider source = (JSlider) evt.getSource(); server.togglePower(source.getValue()); }
From source file:ro.nextreports.designer.wizpublish.JcrBrowserTree.java
public JcrBrowserTree(final byte typeRoot, WebServiceClient client) { super();/*from w w w. jav a 2 s . c o m*/ this.client = client; populateTree(typeRoot); setCellRenderer(new JcrBrowserTreeRenderer()); getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); instance = this; addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { job(e, true); } public void mouseReleased(MouseEvent e) { job(e, false); } private void job(MouseEvent e, boolean pressed) { if (e.isPopupTrigger()) { final TreePath selPath = getPathForLocation(e.getX(), e.getY()); if (selPath == null) { return; } setSelectionPath(selPath); try { final DBBrowserNode selectedNode = (DBBrowserNode) selPath.getLastPathComponent(); if (selectedNode != null) { JPopupMenu popupMenu = new JPopupMenu(); boolean show = false; if ((selectedNode.getDBObject().getType() == DBObject.FOLDER_REPORT) || (selectedNode.getDBObject().getType() == DBObject.DATABASE) || (selectedNode.getDBObject().getType() == DBObject.REPORTS_GROUP) || (selectedNode.getDBObject().getType() == DBObject.CHARTS_GROUP)) { JMenuItem menuItem = new JMenuItem(new PublishFolderAction(selectedNode)); popupMenu.add(menuItem); show = true; } if ((typeRoot == DBObject.DATABASE) && ((selectedNode.getDBObject().getType() == DBObject.FOLDER_REPORT) || (selectedNode.getDBObject().getType() == DBObject.DATABASE))) { PublishDataSourceAction publishDSAction = new PublishDataSourceAction(selectedNode); JMenuItem menuItem2 = new JMenuItem(publishDSAction); popupMenu.add(menuItem2); show = true; } if (show) { popupMenu.show((Component) e.getSource(), e.getX(), e.getY()); } } } catch (Exception ex) { Show.error(ex); } } } }); }
From source file:edu.ku.brc.ui.UIHelper.java
/** * Creates an icon button with tooltip and action listener. * @param iconName the name of the icon (use default size) * @param toolTipTextKey the tooltip text resource bundle key * @param al the action listener// w w w. j av a 2 s.com * @param withEmptyBorder set an empyt border * @return the JButton icon button */ public static JButton createIconBtn(final String iconName, final IconManager.IconSize size, final String toolTipTextKey, final boolean withEmptyBorder, final Action action) { JButton btn = new JButton(action) { @Override public void setEnabled(boolean enabled) { super.setEnabled(enabled); setBorder(emptyBorder); } }; btn.setOpaque(false); if (!withEmptyBorder) { btn.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent e) { if (((JButton) e.getSource()).isEnabled()) { ((JButton) e.getSource()).setBorder(focusBorder); } super.mouseEntered(e); } @Override public void mouseExited(MouseEvent e) { if (((JButton) e.getSource()).isEnabled()) { ((JButton) e.getSource()).setBorder(emptyBorder); } super.mouseExited(e); } }); btn.addFocusListener(new FocusListener() { public void focusGained(FocusEvent e) { if (((JButton) e.getSource()).isEnabled()) { ((JButton) e.getSource()).setBorder(focusBorder); } } public void focusLost(FocusEvent e) { if (((JButton) e.getSource()).isEnabled()) { ((JButton) e.getSource()).setBorder(emptyBorder); } } }); btn.setBorder(emptyBorder); } btn.setIcon(size != null ? IconManager.getIcon(iconName, size) : IconManager.getIcon(iconName)); btn.setText(null); if (StringUtils.isNotEmpty(toolTipTextKey)) { btn.setToolTipText(getResourceString(toolTipTextKey)); } btn.setEnabled(false); btn.setFocusable(true); btn.setMargin(new Insets(0, 0, 0, 0)); setControlSize(btn); return btn; }
From source file:corelyzer.ui.CorelyzerApp.java
public void mousePressed(final MouseEvent e) { // From JDK Doc // Note: Popup menus are triggered differently on different systems. // Therefore, isPopupTrigger should be checked in both mousePressed and // mouseReleased for proper cross-platform functionality. Point p = e.getPoint();/* ww w . j a v a 2 s . c o m*/ Object actionSource = e.getSource(); if (actionSource instanceof JList) { // find the index of the clicked item in the JList int index = ((JList) e.getSource()).locationToIndex(e.getPoint()); if (index < 0) { return; } // show our popup menu if it was a right/ctrl-click if (e.isPopupTrigger()) { if (actionSource.equals(sessionList)) { Session s = (Session) sessionList.getSelectedValue(); JMenuItem t; // Show label switching if (s == null) { return; } String l = s.isShow() ? "Hide" : "Show"; t = (JMenuItem) sessionPopupMenu.getComponent(0); t.setText(l); sessionPopupMenu.show(e.getComponent(), p.x, p.y); } else if (actionSource.equals(trackList)) { ((JList) e.getSource()).setSelectedIndex(index); // Update context-aware show/hide TrackSceneNode t = (TrackSceneNode) trackList.getSelectedValue(); if ((t != null) && (t.getId() >= 0)) { boolean isShown = SceneGraph.getTrackShow(t.getId()); String label = isShown ? "Hide" : "Show"; ((JMenuItem) trackPopupMenu.getComponent(0)).setText(label); } trackPopupMenu.show(e.getComponent(), p.x, p.y); } else if (actionSource.equals(sectionList)) { int[] rows = getSectionList().getSelectedIndices(); JPopupMenu menu = sectionListPopupMenu(rows); menu.show(e.getComponent(), p.x, p.y); } else if (actionSource.equals(dataFileList)) { ((JList) e.getSource()).setSelectedIndex(index); dataPopupMenu.show(e.getComponent(), p.x, p.y); } } } }