Example usage for java.awt.event MouseEvent getClickCount

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

Introduction

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

Prototype

public int getClickCount() 

Source Link

Document

Returns the number of mouse clicks associated with this event.

Usage

From source file:gdsc.smlm.ij.plugins.PeakFit.java

public void mouseClicked(MouseEvent e) {
    if (e.getClickCount() > 1) // Double-click
    {//  ww w. j av a2 s  . c  om
        if (e.getSource() == textConfigFile) {
            String[] path = Utils.decodePath(textConfigFile.getText());
            OpenDialog chooser = new OpenDialog("Config_File", path[0], path[1]);
            if (chooser.getFileName() != null) {
                String newFilename = chooser.getDirectory() + chooser.getFileName();
                textConfigFile.setText(newFilename);
            }
        } else if (e.getSource() == textResultsDirectory) {
            String directory = Utils.getDirectory("Results_dir", textResultsDirectory.getText());
            if (directory != null)
                textResultsDirectory.setText(directory);
        }
    }
}

From source file:ro.nextreports.designer.querybuilder.DBBrowserTree.java

private void selectionQuery(DBBrowserNode selectedNode, MouseEvent e, boolean pressed) {
    OpenQueryAction openAction = new OpenQueryAction();
    openAction.setQueryName(selectedNode.getDBObject().getName());
    openAction.setQueryPath(selectedNode.getDBObject().getAbsolutePath());

    if (e.getClickCount() == 2) {
        if (pressed) {
            openAction.actionPerformed(new ActionEvent(e.getSource(), e.getID(), ""));
        }//from  www. j a v  a 2 s.c om
    } else {
        JPopupMenu popupMenu = new JPopupMenu();
        JMenuItem menuItem = new JMenuItem(openAction);
        popupMenu.add(menuItem);

        NewReportFromQueryAction newReportQAction = new NewReportFromQueryAction();
        newReportQAction.setQueryName(selectedNode.getDBObject().getName());
        newReportQAction.setQueryPath(selectedNode.getDBObject().getAbsolutePath());
        JMenuItem menuItem3 = new JMenuItem(newReportQAction);
        popupMenu.add(menuItem3);

        NewChartFromQueryAction newChartQAction = new NewChartFromQueryAction();
        newChartQAction.setQueryName(selectedNode.getDBObject().getName());
        newChartQAction.setQueryPath(selectedNode.getDBObject().getAbsolutePath());
        JMenuItem menuItem6 = new JMenuItem(newChartQAction);
        popupMenu.add(menuItem6);

        DeleteQueryAction deleteAction = new DeleteQueryAction(instance, selectedNode);
        JMenuItem menuItem2 = new JMenuItem(deleteAction);//
        popupMenu.add(menuItem2);

        RenameQueryAction renameAction = new RenameQueryAction(instance, selectedNode);
        JMenuItem menuItem4 = new JMenuItem(renameAction);
        popupMenu.add(menuItem4);

        ExportQueryAction exportAction = new ExportQueryAction(instance, selectedNode);
        JMenuItem menuItem5 = new JMenuItem(exportAction);
        popupMenu.add(menuItem5);

        JMenuItem menuItem7 = new JMenuItem(new ValidateSqlsAction(selectedNode.getDBObject()));
        popupMenu.add(menuItem7);

        popupMenu.show((Component) e.getSource(), e.getX(), e.getY());
    }
}

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;//  ww  w .  ja  va 2s  .c  o m
    }
    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:com.mirth.connect.client.ui.DashboardPanel.java

/**
 * Makes the status table with all current server information.
 *//*from ww w .j  a  v  a 2s  .co  m*/
public void makeStatusTable() {
    List<String> columns = new ArrayList<String>();

    for (DashboardColumnPlugin plugin : LoadedExtensions.getInstance().getDashboardColumnPlugins().values()) {
        if (plugin.isDisplayFirst()) {
            columns.add(plugin.getColumnHeader());
        }
    }

    columns.addAll(Arrays.asList(defaultColumns));

    for (DashboardColumnPlugin plugin : LoadedExtensions.getInstance().getDashboardColumnPlugins().values()) {
        if (!plugin.isDisplayFirst()) {
            columns.add(plugin.getColumnHeader());
        }
    }

    DashboardTreeTableModel model = new DashboardTreeTableModel();
    model.setColumnIdentifiers(columns);
    model.setNodeFactory(new DefaultDashboardTableNodeFactory());

    for (DashboardTablePlugin plugin : LoadedExtensions.getInstance().getDashboardTablePlugins().values()) {
        dashboardTable = plugin.getTable();

        if (dashboardTable != null) {
            break;
        }
    }

    defaultVisibleColumns.addAll(columns);

    if (dashboardTable == null) {
        dashboardTable = new MirthTreeTable("dashboardPanel", defaultVisibleColumns);
    }

    dashboardTable.setColumnFactory(new DashboardTableColumnFactory());
    dashboardTable.setTreeTableModel(model);
    dashboardTable.setDoubleBuffered(true);
    dashboardTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    dashboardTable.setHorizontalScrollEnabled(true);
    dashboardTable.packTable(UIConstants.COL_MARGIN);
    dashboardTable.setRowHeight(UIConstants.ROW_HEIGHT);
    dashboardTable.setOpaque(true);
    dashboardTable.setRowSelectionAllowed(true);
    dashboardTable.setSortable(true);
    dashboardTable.putClientProperty("JTree.lineStyle", "Horizontal");
    dashboardTable.setAutoCreateColumnsFromModel(false);
    dashboardTable.setShowGrid(true, true);
    dashboardTable.restoreColumnPreferences();
    dashboardTable.setMirthColumnControlEnabled(true);

    dashboardTable.setTreeCellRenderer(new DefaultTreeCellRenderer() {
        @Override
        public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded,
                boolean leaf, int row, boolean hasFocus) {
            JLabel label = (JLabel) super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row,
                    hasFocus);

            TreePath path = dashboardTable.getPathForRow(row);
            if (path != null) {
                AbstractDashboardTableNode node = ((AbstractDashboardTableNode) path.getLastPathComponent());
                if (node.isGroupNode()) {
                    setIcon(UIConstants.ICON_GROUP);
                } else {
                    DashboardStatus status = node.getDashboardStatus();
                    if (status.getStatusType() == StatusType.CHANNEL) {
                        setIcon(UIConstants.ICON_CHANNEL);
                    } else {
                        setIcon(UIConstants.ICON_CONNECTOR);
                    }
                }
            }

            return label;
        }
    });
    dashboardTable.setLeafIcon(UIConstants.ICON_CONNECTOR);
    dashboardTable.setOpenIcon(UIConstants.ICON_CHANNEL);
    dashboardTable.setClosedIcon(UIConstants.ICON_CHANNEL);

    dashboardTableScrollPane.setViewportView(dashboardTable);

    dashboardTable.addMouseListener(new MouseAdapter() {
        @Override
        public void mousePressed(MouseEvent event) {
            checkSelectionAndPopupMenu(event);
        }

        @Override
        public void mouseReleased(MouseEvent event) {
            checkSelectionAndPopupMenu(event);
        }

        @Override
        public void mouseClicked(MouseEvent event) {
            int clickedRow = dashboardTable.rowAtPoint(new Point(event.getX(), event.getY()));
            if (clickedRow == -1) {
                return;
            }

            TreePath path = dashboardTable.getPathForRow(clickedRow);
            if (path != null && ((AbstractDashboardTableNode) path.getLastPathComponent()).isGroupNode()) {
                return;
            }

            if (event.getClickCount() >= 2 && dashboardTable.getSelectedRowCount() == 1
                    && dashboardTable.getSelectedRow() == clickedRow) {
                parent.doShowMessages();
            }
        }
    });

    dashboardTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent event) {
            /*
             * MIRTH-3199: Only update the panel plugin if the selection is finished. This does
             * mean that the logs aren't updated live when adding to or removing from a
             * currently adjusting selection, but it's much more efficient when it comes to the
             * number of requests being done from the client. Plus, it actually will still
             * update while a selection is adjusting if the refresh interval on the dashboard
             * elapses. We can change this so that plugins are updated during a selection
             * adjustment, but it would first require a major rewrite of the connection log /
             * status column plugin.
             */
            updatePopupMenu(!event.getValueIsAdjusting());
        }
    });
}

From source file:ro.nextreports.designer.querybuilder.DBBrowserTree.java

private void selectionChart(DBBrowserNode selectedNode, MouseEvent e, boolean pressed) {
    OpenChartAction openAction = new OpenChartAction();
    openAction.setChartName(selectedNode.getDBObject().getName());
    openAction.setChartPath(selectedNode.getDBObject().getAbsolutePath());

    if (e.getClickCount() == 2) {
        if (pressed) {
            openAction.actionPerformed(new ActionEvent(e.getSource(), e.getID(), ""));
        }/*  w  w  w. j a  va 2 s .  c om*/

    } else {
        JPopupMenu popupMenu = new JPopupMenu();
        JMenuItem menuItem = new JMenuItem(openAction);
        popupMenu.add(menuItem);

        DeleteChartAction deleteAction = new DeleteChartAction(instance, selectedNode);
        JMenuItem menuItem2 = new JMenuItem(deleteAction);
        popupMenu.add(menuItem2);

        RenameChartAction renameAction = new RenameChartAction(instance, selectedNode);
        JMenuItem menuItem3 = new JMenuItem(renameAction);
        popupMenu.add(menuItem3);

        ExportChartAction exportAction = new ExportChartAction(instance, selectedNode);
        JMenuItem menuItem4 = new JMenuItem(exportAction);
        popupMenu.add(menuItem4);

        Chart chart = ChartUtil.loadChart(selectedNode.getDBObject().getAbsolutePath());
        PreviewChartAction previewHTML5Action = new PreviewChartAction(ChartRunner.GRAPHIC_FORMAT,
                ChartRunner.HTML5_TYPE, I18NSupport.getString("preview.html5"));
        previewHTML5Action.setChart(chart);
        popupMenu.add(previewHTML5Action);
        PreviewChartAction previewFlashAction = new PreviewChartAction(ChartRunner.GRAPHIC_FORMAT,
                ChartRunner.FLASH_TYPE, I18NSupport.getString("preview.flash"));
        previewFlashAction.setChart(chart);
        popupMenu.add(previewFlashAction);
        previewFlashAction.setEnabled(!ChartType.hasNoFlashSupport(chart.getType().getType()));
        PreviewChartAction previewImageAction = new PreviewChartAction(ChartRunner.IMAGE_FORMAT,
                ChartRunner.NO_TYPE, I18NSupport.getString("preview.image"));
        previewImageAction.setChart(chart);
        popupMenu.add(previewImageAction);

        PublishChartAction publishAction = new PublishChartAction(selectedNode.getDBObject().getAbsolutePath());
        JMenuItem menuItem5 = new JMenuItem(publishAction);
        popupMenu.add(menuItem5);

        JMenuItem menuItem6 = new JMenuItem(new ValidateSqlsAction(selectedNode.getDBObject()));
        popupMenu.add(menuItem6);

        JMenuItem menuItem7 = new JMenuItem(new AddToFavoritesAction(selectedNode.getDBObject()));
        popupMenu.add(menuItem7);

        popupMenu.show((Component) e.getSource(), e.getX(), e.getY());
    }
}

From source file:ro.nextreports.designer.querybuilder.DBBrowserTree.java

private void selectionReport(DBBrowserNode selectedNode, MouseEvent e, boolean pressed) {
    OpenReportAction openAction = new OpenReportAction();
    openAction.setReportName(selectedNode.getDBObject().getName());
    openAction.setReportPath(selectedNode.getDBObject().getAbsolutePath());

    if (e.getClickCount() == 2) {
        if (pressed) {
            openAction.actionPerformed(new ActionEvent(e.getSource(), e.getID(), ""));
        }/*from w w  w  .j a v a  2  s  . c o  m*/
    } else {
        JPopupMenu popupMenu = new JPopupMenu();
        JMenuItem menuItem = new JMenuItem(openAction);
        popupMenu.add(menuItem);

        DeleteReportAction deleteAction = new DeleteReportAction(instance, selectedNode);
        JMenuItem menuItem2 = new JMenuItem(deleteAction);
        popupMenu.add(menuItem2);

        RenameReportAction renameAction = new RenameReportAction(instance, selectedNode);
        JMenuItem menuItem3 = new JMenuItem(renameAction);
        popupMenu.add(menuItem3);

        ExportReportAction exportAction = new ExportReportAction(instance, selectedNode);
        JMenuItem menuItem4 = new JMenuItem(exportAction);
        popupMenu.add(menuItem4);

        Report report = FormLoader.getInstance().load(selectedNode.getDBObject().getAbsolutePath(), false);
        JMenu runMenu = new JMenu(I18NSupport.getString("export"));
        Globals.setTreeReportAbsolutePath(selectedNode.getDBObject().getAbsolutePath());
        runMenu.add(new JMenuItem(new ExportToHtmlAction(report)));
        runMenu.add(new JMenuItem(new ExportToExcelAction(report)));
        runMenu.add(new JMenuItem(new ExportToPdfAction(report)));
        runMenu.add(new JMenuItem(new ExportToDocxAction(report)));
        runMenu.add(new JMenuItem(new ExportToRtfAction(report)));
        runMenu.add(new JMenuItem(new ExportToCsvAction(report)));
        runMenu.add(new JMenuItem(new ExportToTsvAction(report)));
        runMenu.add(new JMenuItem(new ExportToXmlAction(report)));
        runMenu.add(new JMenuItem(new ExportToTxtAction(report)));
        popupMenu.add(runMenu);

        PublishReportAction publishAction = new PublishReportAction(
                selectedNode.getDBObject().getAbsolutePath());
        JMenuItem menuItem5 = new JMenuItem(publishAction);
        popupMenu.add(menuItem5);

        JMenuItem menuItem6 = new JMenuItem(new ValidateSqlsAction(selectedNode.getDBObject()));
        popupMenu.add(menuItem6);

        JMenuItem menuItem7 = new JMenuItem(new AddToFavoritesAction(selectedNode.getDBObject()));
        popupMenu.add(menuItem7);

        popupMenu.show((Component) e.getSource(), e.getX(), e.getY());
    }
}

From source file:ro.nextreports.designer.querybuilder.DBBrowserTree.java

private void addMouseDoubleClickListener() {
    addMouseListener(new MouseAdapter() {
        public void mousePressed(MouseEvent e) {
            job(e, true);/*from  w w  w  .j a  va  2 s.co  m*/
        }

        public void mouseReleased(MouseEvent e) {
            job(e, false);
        }

        private void job(MouseEvent e, boolean pressed) {
            if (e.isPopupTrigger() || (e.getClickCount() == 2)) {
                final TreePath selPath = getPathForLocation(e.getX(), e.getY());
                if (selPath == null) {
                    return;
                }
                setSelectionPath(selPath);
                try {
                    final DBBrowserNode selectedNode = (DBBrowserNode) selPath.getLastPathComponent();
                    if (selectedNode != null) {
                        if (selectedNode.getDBObject().getType() == DBObject.DATASOURCE) {
                            selectionDataSource(e);
                        } else if (selectedNode.getDBObject().getType() == DBObject.QUERIES_GROUP) {
                            selectionQueryGroup(selectedNode, e);
                        } else if (selectedNode.getDBObject().getType() == DBObject.QUERIES) {
                            selectionQuery(selectedNode, e, pressed);
                        } else if (selectedNode.getDBObject().getType() == DBObject.REPORTS_GROUP) {
                            selectionReportGroup(selectedNode, e);
                        } else if (selectedNode.getDBObject().getType() == DBObject.REPORTS) {
                            selectionReport(selectedNode, e, pressed);
                        } else if (selectedNode.getDBObject().getType() == DBObject.CHARTS_GROUP) {
                            selectionChartGroup(selectedNode, e);
                        } else if (selectedNode.getDBObject().getType() == DBObject.CHARTS) {
                            selectionChart(selectedNode, e, pressed);
                        } else if (selectedNode.getDBObject().getType() == DBObject.DATABASE) {
                            selectionDatabase(selPath, selectedNode, e);
                        } else if ((selectedNode.getDBObject().getType() == DBObject.TABLE)
                                || (selectedNode.getDBObject().getType() == DBObject.VIEW)) {
                            selectionTableOrView(selectedNode, e);
                        } else if (selectedNode.getDBObject().getType() == DBObject.PROCEDURES) {
                            selectionProcedure(selectedNode, e);
                        } else if (selectedNode.getDBObject().getType() == DBObject.PROCEDURES_GROUP) {
                            selectionProcedureGroup(selectedNode, e);
                        } else if (selectedNode.getDBObject().getType() == DBObject.TABLES_GROUP) {
                            selectionTablesGroup(selectedNode, e);
                        } else if (selectedNode.getDBObject().getType() == DBObject.VIEWS_GROUP) {
                            selectionViewsGroup(selectedNode, e);
                        } else if (selectedNode.getDBObject().isFolder()) {
                            selectionFolder(selectedNode, e);
                        }
                    }
                } catch (Exception ex) {
                    Show.error(ex);
                }
            }
        }
    });
}

From source file:corelyzer.ui.CorelyzerGLCanvas.java

public void mouseClicked(final MouseEvent e) {
    Point prePos = e.getPoint();/*w w w.  j ava 2s .c  o m*/
    float sp[] = { 0.0f, 0.0f };
    this.convertMousePointToSceneSpace(prePos, scenePos);

    switch (e.getButton()) {
    case MouseEvent.BUTTON1:
        if (e.getClickCount() > 1) { // doubleclick zoom in/out
            Point mousePos = e.getPoint();

            float[] cp = { 0.0f, 0.0f };
            float[] sc = { 0.0f, 0.0f };

            canvasLock.lock();

            convertMousePointToSceneSpace(mousePos, cp);

            sc[0] = SceneGraph.getSceneCenterX();
            sc[1] = SceneGraph.getSceneCenterY();

            // alt down for zoom out?!
            float base;
            if (e.isAltDown()) { // zoom out
                base = 1.05f;
            } else { // zoom out
                base = 0.95f;
            }

            float scale = (float) Math.pow(base, 3);

            SceneGraph.scaleScene(scale);

            float ncp[] = { 0.0f, 0.0f };

            this.convertMousePointToSceneSpace(mousePos, ncp);
            ncp[0] = ncp[0] - cp[0];
            ncp[1] = ncp[1] - cp[1];

            SceneGraph.panScene(-ncp[0], -ncp[1]);
            canvasLock.unlock();

            CorelyzerApp.getApp().updateGLWindows();
            return;
        }

        // measuring mode
        if (canvasMode == CorelyzerApp.APP_MEASURE_MODE) {
            int nPoint = SceneGraph.addMeasurePoint(scenePos[0], scenePos[1]);
            this.convertScenePointToAbsolute(scenePos, sp);
            if (nPoint == 1) {
                CorelyzerApp.getApp().getToolFrame().addMeasure(sp, 1);
            } else if (nPoint == 2) {
                CorelyzerApp.getApp().getToolFrame().addMeasure(sp, 2);
            }

            PAN_MODE = 0;
            return;
        }

        if (selectedFreeDraw > -1) {
            CorelyzerApp.getApp().getPluginManager().broadcastEventToPlugin(
                    SceneGraph.getFreeDrawPluginID(selectedFreeDraw), CorelyzerPluginEvent.FREE_DRAW_SELECTED,
                    "" + selectedFreeDraw);
            return;
        }

        selectedMarker = SceneGraph.accessPickedMarker();

        if (selectedMarker < 0) {
            if (canvasMode == CorelyzerApp.APP_MARKER_MODE) {
                SceneGraph.setCoreSectionMarkerFocus(false);
                CorelyzerApp.getApp().updateGLWindows();
            }
            return;
        } else {
            if (canvasMode == CorelyzerApp.APP_NORMAL_MODE) {
                AnnotationUtils.openAnnotation(getCanvas(), selectedTrack, selectedTrackSection,
                        selectedMarker);
            } else { // marker mode
                // TODO do something if want to allow user adjust the
                // selected
                // TODO block, like sync to ClastInfo hash...
                if (selectedMarker != SceneGraph.focusedMarker
                        || selectedTrackSection != SceneGraph.focusedTrackSection
                        || selectedTrack != SceneGraph.focusedTrack) {
                    SceneGraph.setCoreSectionMarkerFocus(false);

                    SceneGraph.focusedTrack = selectedTrack;
                    SceneGraph.focusedTrackSection = selectedTrackSection;
                    SceneGraph.focusedMarker = selectedMarker;
                    SceneGraph.setCoreSectionMarkerFocus(true);
                }
            }
        }

        break;

    case MouseEvent.BUTTON2:
        /*
         * System.out.println("---- Middle button clicked at: " +
         * prePos.x + ", " + prePos.y);
         * System.out.println("Converted to Scene Space: " + scenePos[0]
         * + ", " + scenePos[1]);
         */
        break;

    case MouseEvent.BUTTON3:
        /*
         * System.out.println("---- Right button clicked at: " +
         * prePos.x + ", " + prePos.y);
         * System.out.println("Converted to Scene Space: " + scenePos[0]
         * + ", " + scenePos[1]);
         */
        this.handleRightMouseClick(e);
        break;
    default:
        if (e.isPopupTrigger()) {
            this.handleRightMouseClick(e);
        }
    }
}

From source file:com.peter.mavenrunner.MavenRunnerTopComponent.java

private void projectTreeMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_projectTreeMouseClicked
    if (SwingUtilities.isRightMouseButton(evt)) {
        //         int row = projectTree.getClosestRowForLocation(evt.getX(), evt.getY());
        //         projectTree.setSelectionRow(row);
        MyTreeNode node = (MyTreeNode) projectTree.getSelectionPath().getLastPathComponent();
        if (!isDebug) {
            if (node.type.equals("project")) {
                addGoalMenuItem.setEnabled(true);
                editGoalMenuItem.setEnabled(false);
                deleteGoalMenuItem.setEnabled(false);

                runMenuItem.setEnabled(false);
            } else if (node.type.equals("goal")) {
                addGoalMenuItem.setEnabled(false);
                editGoalMenuItem.setEnabled(true);
                deleteGoalMenuItem.setEnabled(true);

                runMenuItem.setEnabled(true);
            } else if (node.type.equals("default goal")) {
                addGoalMenuItem.setEnabled(false);
                editGoalMenuItem.setEnabled(false);
                deleteGoalMenuItem.setEnabled(false);

                runMenuItem.setEnabled(true);
            }//from   w  w  w .  ja  v a  2s.c  o m
        }
        treePopupMenu.show(evt.getComponent(), evt.getX(), evt.getY());
    } else if (evt.getClickCount() == 2) {
        runGoal();
    }
}

From source file:base.BasePlayer.BedTable.java

@Override
public void mouseClicked(MouseEvent event) {
    switch (event.getModifiers()) {
    case InputEvent.BUTTON1_MASK: {
        if (!this.isEnabled()) {
            break;
        }//from w w w.  j  av  a  2 s. com
        if (this.headerHover == -1) {
            if (event.getClickCount() == 2) {
                FileRead.novars = true;

                if (hoverSample > -1) {
                    Main.drawCanvas.drawVariables.visiblestart = (short) (hoverSample);
                    Main.drawCanvas.drawVariables.visiblesamples = (short) (1);
                    Main.drawCanvas.resizeCanvas(Main.drawScroll.getViewport().getWidth(),
                            (int) (Main.samples * Main.drawCanvas.drawVariables.sampleHeight));
                    Draw.setScrollbar((int) (hoverSample * Main.drawCanvas.drawVariables.sampleHeight));
                }
                FileRead.search = true;
                if (hoverVar != null) {

                    VarNode searchHead = hoverVar;

                    while (searchHead.getPrev() != null) {
                        if (searchHead.getPrev().getPosition() == 0) {
                            searchHead.getPrev().putNext(searchHead);
                        }
                        searchHead = searchHead.getPrev();

                    }

                    FileRead.head = searchHead;
                    searchHead = null;
                    Main.drawCanvas.current = hoverVar;

                    if (hoverVar.getExons() != null) {
                        Main.drawCanvas.gotoPos(hoverVar.getExons().get(0).getTranscript().getChrom(),
                                hoverVar.getPosition() + 1 - 50, hoverVar.getPosition() + 1 + 50);
                    } else {
                        if (hoverVar.getTranscripts() != null) {
                            Main.drawCanvas.gotoPos(hoverVar.getTranscripts().get(0).getChrom(),
                                    hoverVar.getPosition() + 1 - 50, hoverVar.getPosition() + 1 + 50);
                        }
                    }
                } else if (hoverNode != null) {
                    VarNode searchHead = hoverNode.varnodes.get(0);

                    while (searchHead.getPrev() != null) {
                        if (searchHead.getPrev().getPosition() == 0) {
                            searchHead.getPrev().putNext(searchHead);
                        }
                        searchHead = searchHead.getPrev();
                    }

                    FileRead.head = searchHead;
                    searchHead = null;
                    Main.drawCanvas.current = hoverNode.varnodes.get(0);

                    Main.drawCanvas.gotoPos(hoverNode.getChrom().replace("chr", ""), hoverNode.getPosition(),
                            hoverNode.getPosition() + hoverNode.getLength());
                }

                break;
            } else if (event.getClickCount() == 1) {

                if (hoverVar != null && (selectedVar == null || !selectedVar.equals(hoverVar))) {

                    selectedVar = hoverVar;
                    selectedString = hoverString;

                    if (selectedVar.isRscode() != null) {
                        hoverString[4] = selectedVar.rscode;
                    }
                    repaint();

                    this.setPreferredSize(new Dimension(this.getWidth(),
                            (this.getTableSize() + 2 + samplecount + Integer.parseInt(selectedString[1]))
                                    * rowHeight));

                    this.revalidate();

                } else if (hoverVar != null && selectedVar.equals(hoverVar)) {

                    if (hoverSample == -1) {

                        selectedVar = null;

                        repaint();
                        this.setPreferredSize(new Dimension(this.getWidth(),
                                (this.getTableSize() + 2 + samplecount) * rowHeight));

                        this.revalidate();
                    }
                } else {

                    if (hoverVar != null && selectedNode != null && hoverNode.equals(selectedNode)) {

                        selectedString = hoverString;

                        samplecount = 0;
                        repaint();

                    } else {

                        if (hoverSample == -1) {

                            if (hoverNode != null) {
                                if (selectedNode != null && selectedNode.equals(hoverNode)) {

                                    selectedString = null;
                                    selectedNode = null;
                                    hoverVar = null;
                                    selectedVar = null;
                                    aminoarray = null;
                                    this.setPreferredSize(new Dimension(this.getWidth(),
                                            (this.getTableSize() + 2) * rowHeight));

                                    this.revalidate();

                                    repaint();
                                    break;
                                }

                                selectedNode = hoverNode;
                                selectedString = hoverString;
                                //   samplecount = selectedNode.mutations;
                                samplecount = selectedNode.varnodes.size();
                                if (VariantHandler.tabs.getSelectedIndex() == 0) {

                                    this.setPreferredSize(new Dimension(this.getWidth(),
                                            (this.getTableSize() + 2 + samplecount) * rowHeight));
                                    this.revalidate();
                                    getAminos(selectedNode);
                                    this.repaint();
                                } else {
                                    this.setPreferredSize(new Dimension(this.getWidth(),
                                            (this.getTableSize() + 2 + samplecount) * rowHeight));
                                    this.revalidate();
                                    getAminos(selectedNode);
                                    repaint();
                                }
                            }
                        }

                    }
                }
            }
        }
        break;
    }
    case InputEvent.BUTTON3_MASK: {

        selectedNode = null;
        selectedVar = null;
        repaint();
    }
    }
}