Example usage for java.awt.event MouseEvent getModifiers

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

Introduction

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

Prototype

@Deprecated(since = "9")
public int getModifiers() 

Source Link

Document

Returns the modifier mask for this event.

Usage

From source file:org.gumtree.vis.plot1d.Plot1DPanel.java

/**
 * Receives notification of mouse clicks on the panel. These are
 * translated and passed on to any registered {@link ChartMouseListener}s.
 *
 * @param event  Information about the mouse event.
 *///from ww w  . j  a va 2s. co m
@Override
public void mouseClicked(MouseEvent event) {

    Insets insets = getInsets();
    int x = (int) ((event.getX() - insets.left) / getScaleX());
    int y = (int) ((event.getY() - insets.top) / getScaleY());

    setAnchor(new Point2D.Double(x, y));
    if (getChart() == null) {
        return;
    }
    //        getChart().setNotify(true);  // force a redraw
    // new entity code...
    //        if (listeners.length == 0) {
    //            return;
    //        }

    //        if ((event.getModifiers() & maskingSelectionMask) != 0) {
    if (isInternalLegendEnabled) {
        Rectangle2D screenArea = getScreenDataArea();
        Rectangle2D legendArea = new Rectangle2D.Double(screenArea.getMaxX() - internalLegendSetup.getMinX(),
                screenArea.getMinY() + internalLegendSetup.getMinY(), internalLegendSetup.getWidth(),
                internalLegendSetup.getHeight());
        if (legendArea.contains(event.getPoint())) {
            selectInternalLegend(true);
            selectMask(Double.NaN, Double.NaN);
            repaint();
            return;
        } else {
            selectInternalLegend(false);
        }
    }
    if (!isTextInputEnabled() && (event.getModifiers() & MouseEvent.BUTTON1_MASK) != 0) {
        selectMask(ChartMaskingUtilities.translateScreenX(x, getScreenDataArea(), getChart()), Double.NaN);
        repaint();
    }
    if ((event.getModifiers() & seriesSelectionEventMask) == 0) {
        if (getSelectedMask() != null && (event.getModifiers() & MouseEvent.BUTTON1_MASK) != 0
                && !getSelectedMask().getRange()
                        .contains(ChartMaskingUtilities.translateScreenX(x, getScreenDataArea(), getChart()))) {
            selectMask(Double.NaN, Double.NaN);
        }
        repaint();
    } else if (!isTextInputEnabled()) {
        selectMask(ChartMaskingUtilities.translateScreenX(x, getScreenDataArea(), getChart()), Double.NaN);
        repaint();
    }

    ChartEntity entity = null;
    if (getChartRenderingInfo() != null) {
        EntityCollection entities = getChartRenderingInfo().getEntityCollection();
        if (entities != null) {
            entity = entities.getEntity(x, y);
            if (entity instanceof XYItemEntity) {
                XYItemEntity xyEntity = (XYItemEntity) entity;
                //                   XYDataset dataset = xyEntity.getDataset();
                //                   int item = ((XYItemEntity) entity).getItem();
                //                   chartX = dataset.getXValue(xyEntity.getSeriesIndex(), item);
                //                   chartY = dataset.getYValue(xyEntity.getSeriesIndex(), item);
                //                   Point2D screenPoint = ChartMaskingUtilities.translateChartPoint(
                //                         new Point2D.Double(chartX, chartY), getScreenDataArea(), getChart());
                //                   if (getHorizontalAxisTrace()) {
                //                      horizontalTraceLocation = (int) screenPoint.getX();
                //                   }
                //                   if (getVerticalAxisTrace()) {
                //                      verticalTraceLocation = (int) screenPoint.getY();
                //                   }
                if ((event.getModifiers() & seriesSelectionEventMask) != 0
                        && (event.getModifiers() & MouseEvent.BUTTON1_MASK) != 0) {
                    selectSeries(xyEntity.getSeriesIndex());
                    return;
                } else if ((event.getModifiers() & maskingSelectionMask) == 0
                        && (event.getModifiers() & MouseEvent.BUTTON1_MASK) != 0) {
                    if (selectedSeriesIndex != xyEntity.getSeriesIndex()) {
                        selectSeries(-1);
                        return;
                    }
                }
            } else {
                if (selectedSeriesIndex >= 0) {
                    if ((event.getModifiers() & seriesSelectionEventMask) != 0
                            && (event.getModifiers() & maskingSelectionMask) == 0
                            && (event.getModifiers() & MouseEvent.BUTTON1_MASK) != 0) {
                        selectSeries(-1);
                        return;
                    }
                }
            }
        }
    }
    XYChartMouseEvent chartEvent = new XYChartMouseEvent(getChart(), event, entity);
    chartEvent.setXY(getChartX(), getChartY());
    Object[] listeners = getListeners(ChartMouseListener.class);
    for (int i = listeners.length - 1; i >= 0; i -= 1) {
        ((ChartMouseListener) listeners[i]).chartMouseClicked(chartEvent);
    }
    super.mouseClicked(event);
}

From source file:org.gumtree.vis.plot1d.Plot1DPanel.java

private void makeNewMask(MouseEvent e) {
    Point2D screenPoint = translateScreenToJava2D(e.getPoint());
    if (Double.isNaN(maskPoint) || Math.abs(screenPoint.getX() - maskPoint) < minMaskWidth) {
        return;/*from w w w .j  a va 2 s . co m*/
    }
    Graphics2D g2 = (Graphics2D) getGraphics();

    // erase the previous zoom rectangle (if any).  We only need to do
    // this is we are using XOR mode, which we do when we're not using
    // the buffer (if there is a buffer, then at the end of this method we
    // just trigger a repaint)
    if (!isDoubleBuffered()) {
        //          drawZoomRectangle(g2, true);
        ChartMaskingUtilities.drawMasks(g2, getScreenDataArea(), getMaskMap(), getSelectedMask(), getChart());
    }

    //       boolean hZoom = false;
    //       boolean vZoom = false;
    //       if (this.orientation == PlotOrientation.HORIZONTAL) {
    //          hZoom = this.rangeZoomable;
    //          vZoom = this.domainZoomable;
    //       }
    //       else {
    //          hZoom = this.domainZoomable;
    //          vZoom = this.rangeZoomable;
    //       }
    Rectangle2D scaledDataArea = getScreenDataArea();
    //             (int) this.maskPoint.getX(), (int) this.maskPoint.getY());
    // Working on the current mask. Only create one new mask per drag-drawing.
    if (currentMaskRectangle == null) {
        boolean isInclusive = (e.getModifiers() & maskingExclusiveMask) == 0;
        currentMaskRectangle = new RangeMask(isInclusive);
        //           currentMaskRectangle.setFillColor(getNextMaskColor(isInclusive));
        //           getMasks().add(currentMaskRectangle);
        addMask(currentMaskRectangle);
    }
    // selected rectangle shouldn't extend outside the data area...
    double xmax = Math.min(e.getX(), scaledDataArea.getMaxX());
    // Update the current mask.
    Insets insets = getInsets();
    double startX = ChartMaskingUtilities.translateScreenX((maskPoint - insets.left) / getScaleX(),
            getScreenDataArea(), getChart());
    double endX = ChartMaskingUtilities.translateScreenX((xmax - insets.left) / getScaleX(),
            getScreenDataArea(), getChart());
    updateCurrentDomainMask(startX, endX);
    // Draw the new zoom rectangle...
    if (isDoubleBuffered()) {
        repaint();
    } else {
        // with no buffer, we use XOR to draw the rectangle "over" the
        // chart...
        ChartMaskingUtilities.drawMasks(g2, getScreenDataArea(), getMaskMap(), getSelectedMask(), getChart());
    }
    g2.dispose();
}

From source file:org.gumtree.vis.hist2d.Hist2DPanel.java

/**
 * Handles a 'mouse dragged' event.// w  ww .j  a  va  2s .c o  m
 *
 * @param e  the mouse event.
 */
public void mouseDragged(MouseEvent e) {

    setHorizontalTraceLocation(e.getX());
    setVerticalTraceLocation(e.getY());

    Insets insets = getInsets();
    int x = (int) ((e.getX() - insets.left) / getScaleX());
    int y = (int) ((e.getY() - insets.top) / getScaleY());

    EntityCollection entities = null;
    ChartEntity entity = null;
    if (getChartRenderingInfo() != null) {
        entities = getChartRenderingInfo().getEntityCollection();
        if (entities != null) {
            entity = entities.getEntity(x, y);
        }
    }
    if (entity instanceof XYItemEntity) {
        IDataset dataset = (IDataset) ((XYItemEntity) entity).getDataset();
        int item = ((XYItemEntity) entity).getItem();
        setChartX(dataset.getXValue(0, item));
        setChartY(dataset.getYValue(0, item));
        setChartZ(((XYZDataset) dataset).getZValue(0, item));
    }

    //        if (isMaskingEnabled() && (e.getModifiers() & maskingKeyMask) != 0) {
    if (isMaskingEnabled()) {
        int cursorType = findCursorOnSelectedItem(e.getX(), e.getY());
        setCursor(Cursor.getPredefinedCursor(cursorType));
    } else if (getCursor() != defaultCursor) {
        setCursor(defaultCursor);
    }

    // we can only generate events if the panel's chart is not null
    // (see bug report 1556951)
    Object[] listeners = getListeners(ChartMouseListener.class);
    if (getChart() != null) {
        XYZChartMouseEvent event = new XYZChartMouseEvent(getChart(), e, entity);
        event.setXYZ(getChartX(), getChartY(), getChartZ());
        for (int i = listeners.length - 1; i >= 0; i -= 1) {
            ((ChartMouseListener) listeners[i]).chartMouseMoved(event);
        }
    }
    if (getMaskDragIndicator() != Cursor.DEFAULT_CURSOR && getSelectedMask() != null
            && (e.getModifiers() & MouseEvent.BUTTON1_MASK) != 0) {
        changeSelectedMask(e, entities);
    } else if (isMaskingEnabled() && (e.getModifiers() & maskingKeyMask) != 0) {
        makeNewMask(e, entities);
    } else {
        super.mouseDragged(e);
    }
}

From source file:com.jcraft.weirdx.DDXWindowImpSwing.java

public void mouseEntered(MouseEvent e) {

    if (window != null && window.getFrame() != null) {
        java.awt.Window frame = window.getFrame();
        if ((frame instanceof java.awt.Frame) && frame == e.getSource()) {
            try {
                if (window.isRealized()) {
                    XWindow.setInputFocus(window.client, window.id, 1, (int) System.currentTimeMillis(), false);
                }//from  ww  w.j  av  a2  s . co m
            } catch (Exception ee) {
                LOG.error(ee);
            }
            return;
        }
    }

    String str = CopyPaste.getString();
    if (!CopyPaste.isOwner() && str != null) {
        synchronized (window.screen.root) {
            Property p = window.screen.root.getProperty();
            while (p != null) {
                if (p.propertyName == 9)
                    break;
                p = p.next;
            }
            if (p != null) {
                p.data = str.getBytes();
                p.size = p.data.length;
            }
        }

        Selection sel = Selection.getSelection(1); // PRIMARY
        if (sel != null && sel.client != null) {
            int time = (int) System.currentTimeMillis();
            Event event = new Event();
            event.mkSelectionClear(time, sel.wid, sel.selection);
            try {
                sel.client.sendEvent(event, 1, Event.NoEventMask, Event.NoEventMask, null);
            } catch (Exception ee) {
                //System.out.println(ee);
            }
            ;
            sel.window = window.screen.root;
            sel.wid = window.screen.root.id;
            sel.lastTimeChanged = time;
            sel.client = null;
        }
        CopyPaste.setString(str);
    }

    if (window.id == window.screen.rootId) {
        return;
    }

    if (window.isMapped()) {
        requestFocus();
        XWindow.focus.win = window.id;
    }

    int x = e.getX() + window.x;
    int y = e.getY() + window.y;

    XWindow.sprite.hot.x = x;
    XWindow.sprite.hot.y = y;

    int mod = e.getModifiers();
    int state = 0;
    if ((mod & InputEvent.BUTTON1_MASK) != 0)
        state |= (1 << 8);
    if ((mod & InputEvent.BUTTON2_MASK) != 0)
        state |= (1 << 9);
    if ((mod & InputEvent.BUTTON3_MASK) != 0)
        state |= (1 << 10);
    if ((mod & InputEvent.SHIFT_MASK) != 0)
        state |= 1;
    if ((mod & InputEvent.CTRL_MASK) != 0)
        state |= 4;
    // alt -> state|=8;
    Client client = window.client;
    if (client == null || client == serverClient)
        return;

    event.mkEnterNotify(0, // Ancestor
            window.screen.rootId, window.id, 0, x, y, e.getX(), e.getY(), state, 0, // Normal
            0x1 | 0x02 // focus|same-screen
    );
    try {
        XWindow.sendDeviceEvent(window, event, XWindow.grab, null, 1);
    } catch (Exception ee) {
    }
}

From source file:com.jcraft.weirdx.DDXWindowImp.java

public void mouseEntered(MouseEvent e) {
    if (window == null)
        return;/*w ww  .j a  v a2 s.c o  m*/
    if (window.getFrame() != null) {
        java.awt.Window frame = window.getFrame();
        if ((frame instanceof java.awt.Frame) && frame == e.getSource()) {
            try {
                if (window.isRealized()) {
                    XWindow.setInputFocus(window.client, window.id, 1, (int) System.currentTimeMillis(), false);
                }
            } catch (Exception ee) {
                LOG.error(ee);
            }
            return;
        }
    }

    String str = CopyPaste.getString();
    if (!CopyPaste.isOwner() && str != null) {
        synchronized (window.screen.root) {
            Property p = window.screen.root.getProperty();
            while (p != null) {
                if (p.propertyName == 9)
                    break;
                p = p.next;
            }
            if (p != null) {
                p.data = str.getBytes();
                p.size = p.data.length;
            }
        }

        Selection sel = Selection.getSelection(1); // PRIMARY
        if (sel != null && sel.client != null) {
            int time = (int) System.currentTimeMillis();
            Event event = new Event();
            event.mkSelectionClear(time, sel.wid, sel.selection);
            try {
                sel.client.sendEvent(event, 1, Event.NoEventMask, Event.NoEventMask, null);
            } catch (Exception ee) {
                //System.out.println(ee);
            }
            ;
            sel.window = window.screen.root;
            sel.wid = window.screen.root.id;
            sel.lastTimeChanged = time;
            sel.client = null;
        }
        CopyPaste.setString(str);
    }

    if (window.id == window.screen.rootId) {
        return;
    }

    if (window.isMapped()) {
        requestFocus();
        XWindow.focus.win = window.id;
    }

    int x = e.getX() + window.x;
    int y = e.getY() + window.y;

    XWindow.sprite.hot.x = x;
    XWindow.sprite.hot.y = y;

    int mod = e.getModifiers();
    int state = 0;
    if ((mod & InputEvent.BUTTON1_MASK) != 0)
        state |= (1 << 8);
    if ((mod & InputEvent.BUTTON2_MASK) != 0)
        state |= (1 << 9);
    if ((mod & InputEvent.BUTTON3_MASK) != 0)
        state |= (1 << 10);
    if ((mod & InputEvent.SHIFT_MASK) != 0)
        state |= 1;
    if ((mod & InputEvent.CTRL_MASK) != 0)
        state |= 4;
    // alt -> state|=8;
    Client client = window.client;
    if (client == null || client == serverClient)
        return;

    event.mkEnterNotify(0, // Ancestor
            window.screen.rootId, window.id, 0, x, y, e.getX(), e.getY(), state, 0, // Normal
            0x1 | 0x02 // focus|same-screen
    );
    try {
        XWindow.sendDeviceEvent(window, event, XWindow.grab, null, 1);
    } catch (Exception ee) {
    }
}

From source file:com.actelion.research.table.view.JVisualization.java

public void mouseClicked(MouseEvent e) {
    if ((e.getModifiers() & InputEvent.BUTTON1_MASK) != 0) {
        VisualizationPoint marker = findMarker(e.getX(), e.getY());
        if (mActivePoint != marker) {
            // don't allow root de-selection if we are in a dedicated tree view
            boolean isPureTreeView = isTreeViewGraph() && !mTreeViewShowAll;
            if (marker != null || !isPureTreeView)
                mTableModel.setActiveRow(marker == null ? null : marker.record);
        }/*from   www .jav  a 2s. c o  m*/
    }
}

From source file:org.gumtree.vis.hist2d.Hist2DPanel.java

/**
 * Receives notification of mouse clicks on the panel. These are
 * translated and passed on to any registered {@link ChartMouseListener}s.
 *
 * @param event  Information about the mouse event.
 *///from   w w  w .j  av  a2s .c o  m
public void mouseClicked(MouseEvent event) {

    Insets insets = getInsets();
    int x = (int) ((event.getX() - insets.left) / getScaleX());
    int y = (int) ((event.getY() - insets.top) / getScaleY());

    double chartX = 0;
    double chartY = 0;
    double chartZ = 0;
    setAnchor(new Point2D.Double(x, y));
    if (getChart() == null) {
        return;
    }

    //        this.chart.setNotify(true);  // force a redraw
    // new entity code...
    //        Object[] listeners = this.chartMouseListeners.getListeners(
    //                ChartMouseListener.class);

    ChartEntity entity = null;
    if (getChartRenderingInfo() != null) {
        EntityCollection entities = getChartRenderingInfo().getEntityCollection();
        if (entities != null) {
            entity = entities.getEntity(x, y);
        }
    }

    if (entity instanceof XYItemEntity) {
        IDataset dataset = (IDataset) ((XYItemEntity) entity).getDataset();
        int item = ((XYItemEntity) entity).getItem();
        chartX = dataset.getXValue(0, item);
        chartY = dataset.getYValue(0, item);
        chartZ = ((XYZDataset) dataset).getZValue(0, item);
        //           System.out.println("px=" + x + ", py=" + y);
        //           System.out.println("x=" + chartX + ", y=" + chartY + ", z=" + chartZ);
        //        Point2D trsPoint = translateChartPoint(new Point2D.Double(chartX, chartY));
        //        System.out.println("tx=" + trsPoint.getX() + ", y=" + trsPoint.getY());
        //            if ((event.getModifiers() & maskingSelectionMask) != 0) {
        //               selectMask(chartX, chartY);
        //               repaint();
        //            } else {
        //               if (getSelectedMask() != null && (event.getModifiers() & MouseEvent.BUTTON1_MASK) != 0 
        //                     && !getSelectedMask().getShape().contains(chartX, chartY)) {
        //                  selectMask(null);
        //                  repaint();
        //               }
        //            }
        if ((event.getModifiers() & MouseEvent.BUTTON1_MASK) != 0) {
            selectMask(chartX, chartY);
            repaint();
        }
    }

    Object[] listeners = getListeners(ChartMouseListener.class);

    XYZChartMouseEvent chartEvent = new XYZChartMouseEvent(getChart(), event, entity);
    chartEvent.setXYZ(chartX, chartY, chartZ);
    for (int i = listeners.length - 1; i >= 0; i -= 1) {
        ((ChartMouseListener) listeners[i]).chartMouseClicked(chartEvent);
    }
}

From source file:gda.plots.SimplePlot.java

/**
 * Part of the implementation of MouseMotionListener - overrides the super class (ChartPanel) implementation so that
 * the mouse can be used to select a rectangle as well as for zooming.
 * //  w  w w . j  a v a2  s. c  om
 * @param e
 *            the mouse event which caused the call
 */
@Override
public void mouseDragged(MouseEvent e) {
    // If the rectangle dragger is not in operation then call the
    // super class method (to deal with any possible zooming) then
    // deal with magnifyingImage or magnifyingData.

    if (rd == null) {
        super.mouseDragged(e);
        if ((magnifyingImage || magnifyingData) && (e.getModifiers() & InputEvent.BUTTON3_MASK) == 0) {
            Graphics2D g2 = (Graphics2D) getGraphics();
            g2.setXORMode(dragColour);
            if (magnifyRectangle != null) {
                if (magnifyRectangleIsNew) {
                    magnifyRectangleIsNew = false;
                } else {
                    g2.fill(magnifyRectangle);
                }
            }
            if ((e.getModifiers() & InputEvent.BUTTON1_MASK) != 0) {
                magnifyWidth = e.getX() - magnifyXPoint;
                magnifyHeight = e.getY() - magnifyYPoint;
            }
            recalculateMagnifyRectangle(e);

            if ((e.getModifiers() & InputEvent.BUTTON2_MASK) != 0) {
                magnifier.update(magnifyRectangle);
            }

            if (magnifyRectangle != null) {
                g2.fill(magnifyRectangle);
            }
            g2.dispose();
        }
    } else {
        rd.mouseDragged(e);
    }
}

From source file:base.BasePlayer.BedCanvas.java

public void mouseClicked(MouseEvent event) {
    switch (event.getModifiers()) {
    case InputEvent.BUTTON1_MASK: {
        if (selectedPlay > -1 && bedTrack.get(selectedPlay).playbox.intersects(sideMouseRect)) {
            if (!Main.drawCanvas.loading) {

                pressIntersect(bedTrack.get(selectedPlay));
            }/*  ww  w .j a v a  2  s.c  o m*/
        } else if (selectedPlay > -1 && bedTrack.get(selectedPlay).graphBox.intersects(sideMouseRect)) {
            pressGraph(bedTrack.get(selectedPlay));
        } else if (removeTrack > -1) {
            removeTrack(removeTrack);
        }
        break;
    }
    case InputEvent.BUTTON3_MASK: {

        if (!sidebar) {
            this.bedTrack.get(hoverIndex).getPopup().show(this, mouseX, mouseY);
        }
    }
    }
    Draw.updatevars = true;
    repaint();

}

From source file:base.BasePlayer.BedCanvas.java

@SuppressWarnings("unchecked")
public void mouseDragged(MouseEvent event) {
    switch (event.getModifiers()) {

    case InputEvent.BUTTON1_MASK: {
        if (sidebar) {
            return;
        }/*  w w w . j  a v  a2 s  .co m*/
        this.mouseX = event.getX();
        this.mouseY = event.getY();

        if (resizer && this.getHeight() > this.trackDivider.size() * 20) {

            this.trackDivider.set(this.resizeDivider, mouseY / (double) this.getHeight());

            if ((positivelock || negative)
                    && this.trackDivider.get(this.resizeDivider) * this.getHeight() - preresizer >= 0) {
                positivelock = false;
                negative = false;
                preresize = mouseY;
                tempDivider = (ArrayList<Double>) trackDivider.clone();

            } else if ((!negative || negativelock)
                    && this.trackDivider.get(this.resizeDivider) * this.getHeight() - preresizer < 0) {
                negativelock = false;
                preresize = mouseY;
                tempDivider = (ArrayList<Double>) trackDivider.clone();
                negative = true;
            }

            if (negativelock) { // || (this.trackDivider.get(this.resizeDivider+1)*this.getHeight()) -(this.trackDivider.get(this.resizeDivider)*this.getHeight()) < 20) {
                this.trackDivider.set(this.resizeDivider,
                        (this.trackDivider.get(this.resizeDivider + 1) * this.getHeight() - 19)
                                / (double) this.getHeight());
            }
            if (positivelock) { // || (this.trackDivider.get(this.resizeDivider+1)*this.getHeight()) -(this.trackDivider.get(this.resizeDivider)*this.getHeight()) < 20) {
                this.trackDivider.set(this.resizeDivider, 19 / (double) this.getHeight());
            }
            if (this.trackDivider.get(this.resizeDivider) * this.getHeight() - preresizer < 0) {

                negative = true;
                positivelock = true;
                if (this.resizeDivider > 0) {

                    for (int i = 1; i < this.resizeDivider + 1; i++) {
                        if ((this.trackDivider.get(i) * this.getHeight())
                                - (this.trackDivider.get(i - 1) * this.getHeight()) < 20) {

                            this.trackDivider.set(i, ((this.trackDivider.get(i - 1) * this.getHeight()) + 19)
                                    / (double) this.getHeight());
                        } else {
                            positivelock = false;
                            if (i != this.resizeDivider) {
                                this.trackDivider.set(i, (this.tempDivider.get(i) / preresize) * mouseY);
                            }
                        }
                    }
                }
                if ((this.trackDivider.get(0) * this.getHeight()) >= 20) {
                    this.trackDivider.set(0, (this.tempDivider.get(0) / preresize) * mouseY);
                    positivelock = false;
                } else {
                    this.trackDivider.set(0, 19 / (double) this.getHeight());
                }

            } else {

                negative = false;
                negativelock = true;
                if (this.resizeDivider < this.trackDivider.size() - 1) {

                    for (int i = this.resizeDivider; i < this.trackDivider.size() - 1; i++) {

                        if ((this.trackDivider.get(i + 1) * this.getHeight())
                                - (this.trackDivider.get(i) * this.getHeight()) < 20) {

                            this.trackDivider.set(i, ((this.trackDivider.get(i + 1) * this.getHeight()) - 19)
                                    / (double) this.getHeight());
                        } else {

                            negativelock = false;
                            if (i != this.resizeDivider) {
                                try {
                                    this.trackDivider.set(i,
                                            1 - ((1 - this.tempDivider.get(i)) / (this.getHeight() - preresize))
                                                    * (this.getHeight() - mouseY));
                                } catch (Exception e) {

                                    //   e.printStackTrace();
                                }
                            }
                        }
                    }
                    if (this.getHeight()
                            - (this.trackDivider.get(this.trackDivider.size() - 2) * this.getHeight()) >= 20) {
                        negativelock = false;
                    } else {
                        this.trackDivider.set(this.trackDivider.size() - 2,
                                (this.getHeight() - 19) / (double) this.getHeight());
                    }

                }
            }

            preresizer = this.trackDivider.get(this.resizeDivider) * this.getHeight();
            repaint();

        } else if (lineZoomer) {

            if (Main.drawCanvas.selectedSplit.start > 1
                    || Main.drawCanvas.selectedSplit.end < Main.drawCanvas.selectedSplit.chromEnd) {
                Main.drawCanvas.gotoPos(
                        Main.drawCanvas.selectedSplit.start
                                - (Main.drawCanvas.tempDrag - mouseX) / Main.drawCanvas.selectedSplit.pixel * 2,
                        Main.drawCanvas.selectedSplit.end + (Main.drawCanvas.tempDrag - mouseX)
                                / Main.drawCanvas.selectedSplit.pixel * 2);
            }

            Main.drawCanvas.tempDrag = mouseX;
            Main.chromDraw.updateExons = true;
            repaint();
            Main.chromDraw.repaint();
            Draw.updatevars = true;
            Main.drawCanvas.repaint();

        } else {
            if (getCursor().getType() != Cursor.N_RESIZE_CURSOR) {
                zoomDrag = true;

                repaint();
            }
            return;
        }
        break;
    }
    case InputEvent.BUTTON3_MASK: {
        if (sidebar) {
            return;
        }
        if ((int) Main.drawCanvas.selectedSplit.start == 1
                && (int) Main.drawCanvas.selectedSplit.end == Main.drawCanvas.selectedSplit.chromEnd) {
            break;
        }

        Main.drawCanvas.mouseDrag = true;
        Main.drawCanvas.moveX = event.getX();
        Main.drawCanvas.drag(Main.drawCanvas.moveX);
        break;
    }
    case 17: {
        if (sidebar) {
            return;
        }
        if ((int) Main.drawCanvas.selectedSplit.start == 1
                && (int) Main.drawCanvas.selectedSplit.end == Main.drawCanvas.selectedSplit.chromEnd) {
            break;
        }

        Main.drawCanvas.mouseDrag = true;
        Main.drawCanvas.moveX = event.getX();
        Main.drawCanvas.drag(Main.drawCanvas.moveX);
        break;
    }
    }
}