Example usage for java.awt.event MouseEvent getY

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

Introduction

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

Prototype

public int getY() 

Source Link

Document

Returns the vertical y position of the event relative to the source component.

Usage

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);
        }/* w  w  w .jav  a 2s .  com*/
    }
}

From source file:com.projity.pm.graphic.spreadsheet.SpreadSheet.java

public void setModel(SpreadSheetModel spreadSheetModel, SpreadSheetColumnModel spreadSheetColumnModel) {
    makeCustomTableHeader(spreadSheetColumnModel);
    TableModel oldModel = getModel();
    setModel(spreadSheetModel);/*from w ww.  j a va 2s . c  o  m*/

    if (spreadSheetColumnModel != null) {
        //System.out.println("creating new ColModel");
        setColumnModel(spreadSheetColumnModel);

        selection = new SpreadSheetSelectionModel(this);
        selection.setRowSelection(new SpreadSheetListSelectionModel(selection, true));
        selection.setColumnSelection(new SpreadSheetListSelectionModel(selection, false));
        setSelectionModel(selection.getRowSelection());
        createDefaultColumnsFromModel(spreadSheetModel.getFieldArray()); //Consume memory
        getColumnModel().setSelectionModel(selection.getColumnSelection());
    }

    registerEditors(); //Consume memory
    initRowHeader(spreadSheetModel);
    initModel();
    initListeners();

    GraphicConfiguration config = GraphicConfiguration.getInstance();
    //fix for substance
    setTableHeader(createDefaultTableHeader());
    JTableHeader header = getTableHeader();
    header.setPreferredSize(
            new Dimension((int) header.getPreferredSize().getWidth(), config.getColumnHeaderHeight()));
    header.addMouseListener(new HeaderMouseListener(this));

    addMouseListener(new MouseAdapter() {
        //         Cursor oldCursor = null;
        //         public void mouseEntered(MouseEvent e) {
        //            Point p = e.getPoint();
        //            int col = columnAtPoint(p);
        //            Field field = ((SpreadSheetModel) getModel()).getFieldInNonTranslatedColumn(col + 1);
        //            System.out.println("mouse entered field " + field);
        //            if (field != null && field.isHyperlink()) {
        //               oldCursor = getCursor();
        //               setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        //               System.out.println("setting new cursor to " + Cursor.getPredefinedCursor(Cursor.HAND_CURSOR) + " old is " + oldCursor);
        //            } else 
        //               super.mouseEntered(e);
        //
        //         }
        //
        //         public void mouseExited(MouseEvent e) {
        //            Point p = e.getPoint();
        //            int col = columnAtPoint(p);
        //            Field field = ((SpreadSheetModel) getModel()).getFieldInNonTranslatedColumn(col + 1);
        //            System.out.println("mouse exited field " + field);
        //            if (field != null && field.isHyperlink()) {
        //               setCursor(oldCursor);
        //               System.out.println("setting old cursor to " + oldCursor);
        //               e.consume();
        //            } else 
        //               super.mouseEntered(e);
        //         }

        public void mousePressed(MouseEvent e) { // changed to mousePressed instead of mouseClicked() for snappier handling 17/5/04 hk
            Point p = e.getPoint();
            int row = rowAtPoint(p);
            int col = columnAtPoint(p);
            SpreadSheetPopupMenu popup = getPopup();
            if (SwingUtilities.isLeftMouseButton(e)) {
                SpreadSheetColumnModel columnModel = (SpreadSheetColumnModel) getColumnModel();
                Field field = ((SpreadSheetModel) getModel()).getFieldInNonTranslatedColumn(col + 1);
                SpreadSheetModel model = (SpreadSheetModel) getModel();
                if (field.isNameField()) {
                    // if (col == columnModel.getNameIndex()) {
                    GraphicNode node = model.getNode(row);
                    if (isOnIcon(e)) {
                        if (model.getCellProperties(node).isCompositeIcon()) {
                            finishCurrentOperations();
                            selection.getRowSelection().clearSelection();
                            boolean change = true;
                            if (!node.isFetched()) // for subprojects
                                change = node.fetch();
                            if (change)
                                model.changeCollapsedState(row);
                            e.consume(); // prevent dbl click treatment below

                            // because editor may have already been
                            // installed we
                            // have to update its collapsed state
                            // updateNameCellEditor(node);

                            // editCellAt(row,model.findGraphicNodeRow(node));
                        }
                    }
                } else if (field != null && field.isHyperlink()) {
                    Hyperlink link = (Hyperlink) model.getValueAt(row, col + 1);
                    if (link != null) {
                        BrowserControl.displayURL(link.getAddress());
                        e.consume(); // prevent dbl click treatment below
                    }

                }
                if (!e.isConsumed()) {
                    if (e.getClickCount() == 2) // if above code didn't treat and is dbl click
                        doDoubleClick(row, col);
                    else
                        doClick(row, col);
                }

            } else if (popup != null && SwingUtilities.isRightMouseButton(e)) { // e.isPopupTrigger() can be used too
                //               selection.getRowSelection().clearSelection();
                //               selection.getRowSelection().addSelectionInterval(row, row);
                popup.setRow(row);
                popup.setCol(col);
                popup.show(SpreadSheet.this, e.getX(), e.getY());
            }
        }
    });

    if (oldModel != spreadSheetModel && oldModel instanceof CommonSpreadSheetModel)
        ((CommonSpreadSheetModel) getModel()).getCache().removeNodeModelListener(this);
    spreadSheetModel.getCache().addNodeModelListener(this);

    //      getColumnModel().addColumnModelListener(new TableColumnModelListener(){
    //         public void columnAdded(TableColumnModelEvent e) {
    //            // TODO Auto-generated method stub
    //            
    //         }
    //         public void columnMarginChanged(ChangeEvent e) {
    //            // TODO Auto-generated method stub
    //            
    //         }
    //         public void columnMoved(TableColumnModelEvent e) {
    //            // TODO Auto-generated method stub
    //            
    //         }
    //         public void columnRemoved(TableColumnModelEvent e) {
    //            // TODO Auto-generated method stub
    //            
    //         }
    //         public void columnSelectionChanged(ListSelectionEvent e) {
    //            System.out.println(((e.getValueIsAdjusting())?"lse=":"LSE=")+e.getFirstIndex()+", "+e.getLastIndex());
    //            SpreadSheet.this.revalidate();
    //            //SpreadSheet.this.paintImmediately(0, 0, getWidth(), GraphicConfiguration.getInstance().getColumnHeaderHeight());
    //         }
    //      });

}

From source file:course_generator.frmMain.java

private void MapViewerMouseClicked(java.awt.event.MouseEvent evt) {
    if (Track.data.size() <= 0)
        return;//from   ww  w . j a va 2s .  c  o m

    //Find the nearest point
    Coordinate c = MapViewer.getPosition(evt.getX(), evt.getY());
    int i = Track.FindNearestPoint(c.getLat(), c.getLon());
    //Selection the position on the data grid
    TableMain.setRowSelectionInterval(i, i);
    Rectangle rect = TableMain.getCellRect(i, 0, true);
    TableMain.scrollRectToVisible(rect);

    //Refresh profil position
    RefreshProfilInfo(i);
    xCrosshair.setValue(Track.data.get(i).getTotal(Settings.Unit) / 1000.0);
    yCrosshair.setValue(Track.data.get(i).getElevation(Settings.Unit));

    //Refresh position marker on the map
    RefreshCurrentPosMarker(Track.data.get(i).getLatitude(), Track.data.get(i).getLongitude());
}

From source file:net.minelord.gui.panes.IRCPane.java

public void connected() {
    SwingUtilities.invokeLater(new Runnable() {

        @Override// w  ww .j ava 2  s .  c  om
        public void run() {
            scroller.setBounds(scrollerWithoutTopicWithUserlist);
            scroller.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
            status = "Connected";
            client.connectAlertListener();
            TitledBorder title = BorderFactory
                    .createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), "Connected");
            title.setTitleJustification(TitledBorder.RIGHT);
            userList = new JList(client.getUserList().toArray());
            userScroller = new JScrollPane(userList);
            userScroller.setBounds(userScrollerWithoutTopic);
            userList.setBounds(0, 0, 210, 250);
            userList.setBackground(Color.gray);
            userList.setForeground(Color.gray.darker().darker().darker());
            userScroller.setBorder(title);
            userScroller.getVerticalScrollBar().setUnitIncrement(5);
            scroller.setBorder(BorderFactory
                    .createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), ""));
            if (client.getTopic().trim().length() > 0) {
                topic = new JLabel(client.getTopic());
                scroller.setBounds(scrollerWithTopicWithUserlist);
                userScroller.setBounds(userScrollWithTopic);
                userList.setBounds(0, 0, 210, 225);
                title = BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED),
                        "Topic set by " + client.getTopicSetter());
                title.setTitleJustification(TitledBorder.LEFT);
                topic.setBorder(title);
                topic.setBounds(topicBounds);
                add(topic);
            } else
                topic = new JLabel("");
            input.setEnabled(true);
            input.requestFocus();
            final JPopupMenu userPopup = new JPopupMenu();
            JLabel breakLine = new JLabel("____");
            JLabel help = new JLabel("Politely ask for help");
            JLabel message = new JLabel("Message");
            JLabel sortNormal = new JLabel("Normal");
            JLabel sortAlphabetical = new JLabel("Alphabetical");
            JLabel sortRoles = new JLabel("Roles");

            help.addMouseListener(new MouseAdapter() {
                public void mousePressed(MouseEvent e) {
                    userPopup.setVisible(false);
                    sendMessage("/me kicks " + userList.getModel().getElementAt(userList.getSelectedIndex())
                            + " in the shins");
                    sendMessage("I need help you pleb");
                }

                public void mouseReleased(MouseEvent e) {
                }
            });
            message.addMouseListener(new MouseAdapter() {

                @Override
                public void mouseReleased(MouseEvent paramMouseEvent) {
                    userPopup.setVisible(false);
                    input.setText("/msg " + userList.getModel().getElementAt(userList.getSelectedIndex())
                            + (input.getText().length() > 0 && input.getText().charAt(0) == ' '
                                    ? input.getText()
                                    : " " + input.getText()));
                    input.select(0, ("/msg " + userList.getModel().getElementAt(userList.getSelectedIndex())
                            + (input.getText().length() > 0 && input.getText().charAt(0) == ' ' ? "" : " "))
                                    .length());
                    input.requestFocus();
                }
            });
            sortNormal.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseReleased(MouseEvent paramMouseEvent) {
                    userPopup.setVisible(false);
                    updateUserList(0);
                }
            });
            sortAlphabetical.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseReleased(MouseEvent paramMouseEvent) {
                    userPopup.setVisible(false);
                    updateUserList(1);
                }
            });
            sortRoles.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseReleased(MouseEvent paramMouseEvent) {
                    userPopup.setVisible(false);
                    updateUserList(2);
                }
            });
            userPopup.add(help);
            userPopup.add(message);
            userPopup.add(breakLine);
            userPopup.add(sortNormal);
            userPopup.add(sortAlphabetical);
            userPopup.add(sortRoles);

            userList.addMouseListener(new MouseAdapter() {
                public void mousePressed(MouseEvent e) {
                    check(e);
                }

                public void mouseReleased(MouseEvent e) {
                    check(e);
                }

                public void check(MouseEvent e) {
                    userList.setSelectedIndex(userList.locationToIndex(e.getPoint()));
                    userPopup.show(userList, e.getX(), e.getY());
                }
            });
            add(userScroller);

            final JPopupMenu textPopup = new JPopupMenu();
            JLabel copy = new JLabel("Copy");
            copy.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseReleased(MouseEvent paramMouseEvent) {
                    textPopup.setVisible(false);
                    if (text.getSelectedText() != null && text.getSelectedText().length() != 0) {
                        StringSelection selection = new StringSelection(text.getSelectedText());
                        Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
                        clipboard.setContents(selection, selection);
                    }
                }
            });
            textPopup.add(copy);
            text.addMouseListener(new MouseAdapter() {
                public void mousePressed(MouseEvent e) {
                }

                public void mouseReleased(MouseEvent e) {
                    if (SwingUtilities.isRightMouseButton(e))
                        textPopup.show(text, e.getX(), e.getY());
                }
            });
            add(userScroller);
            repaint();
        }
    });
}

From source file:gda.plots.SimplePlot.java

/**
 * Converts the (pixel) coordinates of a MouseEvent into their actual plot value equivalents
 * //from w w w  .j ava2s.  c  o m
 * @param me
 *            the MouseEvent to be converted
 * @return SimpleDataCoordinate object containing the converted coordinates
 */
public SimpleDataCoordinate convertMouseEvent(MouseEvent me) {
    SimpleDataCoordinate sdc = new SimpleDataCoordinate(
            xYPlot.getDomainAxis().java2DToValue(me.getX(), getScreenDataArea(), xYPlot.getDomainAxisEdge()),

            xYPlot.getRangeAxis().java2DToValue(me.getY(), getScreenDataArea(), xYPlot.getRangeAxisEdge()));
    if (dependentXAxisOn) {
        sdc.setDependentXCalibrationValues(this.emForXAxis, this.seeForXAxis);
    }
    if (dependentYAxisOn) {
        sdc.setDependentYCalibrationValues(this.emForYAxis, this.seeForYAxis);
    }
    return sdc;

}

From source file:gdt.jgui.entity.webset.JWeblinkEditor.java

private void showIconMenu(MouseEvent e) {
    try {/*from  w w  w  . j a v a  2s .  c o m*/
        iconMenu = new JPopupMenu();
        JMenuItem loadItem = new JMenuItem("Load");
        iconMenu.add(loadItem);
        loadItem.setHorizontalTextPosition(JMenuItem.RIGHT);
        loadItem.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    String favicon$ = "http://www.google.com/s2/favicons?domain=" + addressField.getText();
                    URL url = new URL(favicon$);
                    HttpURLConnection connection = (HttpURLConnection) url.openConnection();
                    connection.setDoInput(true);
                    connection.connect();
                    InputStream input = connection.getInputStream();
                    ImageIcon icon = new ImageIcon(ImageIO.read(input));
                    int type = BufferedImage.TYPE_INT_RGB;
                    BufferedImage out = new BufferedImage(24, 24, type);
                    Color background = JWeblinkEditor.this.getBackground();
                    Graphics2D g2 = out.createGraphics();
                    g2.setBackground(background);
                    g2.clearRect(0, 0, 24, 24);
                    Image image = icon.getImage();
                    g2.drawImage(image, 4, 4, null);
                    g2.dispose();
                    icon = new ImageIcon(out);
                    iconIcon.setIcon(icon);
                    input.close();
                } catch (Exception ee) {
                    Logger.getLogger(getClass().getName()).info(ee.toString());
                }
            }
        });
        JMenuItem setItem = new JMenuItem("Set");
        iconMenu.add(setItem);
        setItem.setHorizontalTextPosition(JMenuItem.RIGHT);
        setItem.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                System.out.println("WeblinkEditor:set icon");
                JIconSelector is = new JIconSelector();
                String isLocator$ = is.getLocator();
                if (entihome$ != null)
                    isLocator$ = Locator.append(isLocator$, Entigrator.ENTIHOME, entihome$);
                if (entityKey$ != null)
                    isLocator$ = Locator.append(isLocator$, EntityHandler.ENTITY_KEY, entityKey$);

                String responseLocator$ = getLocator();
                responseLocator$ = Locator.append(responseLocator$, JRequester.REQUESTER_ACTION,
                        ACTION_SET_ICON);
                responseLocator$ = Locator.append(responseLocator$, BaseHandler.HANDLER_METHOD, "response");
                isLocator$ = Locator.append(isLocator$, JRequester.REQUESTER_RESPONSE_LOCATOR,
                        Locator.compressText(responseLocator$));
                JConsoleHandler.execute(console, isLocator$);
            }
        });
        iconMenu.show(e.getComponent(), e.getX(), e.getY());
    } catch (Exception ee) {
        Logger.getLogger(getClass().getName()).severe(ee.toString());
    }
}

From source file:nz.govt.natlib.ndha.manualdeposit.ManualDepositMain.java

private void jobQueueMousePressedCommon(java.awt.event.MouseEvent evt, JTable table) {
    if (evt.isPopupTrigger()) {
        if (table.getSelectedRowCount() == 0) {
            int row = table.rowAtPoint(evt.getPoint());
            if (row > -1) {
                table.setRowSelectionInterval(row, row);
            }//  www  . j  a va  2  s .c  o m
        }
        JPopupMenu menu = depositPresenter.getJobQueueMenu((JTable) evt.getSource());
        if (menu != null) {
            menu.show(evt.getComponent(), evt.getX(), evt.getY());
        }
    }
}

From source file:nz.govt.natlib.ndha.manualdeposit.ManualDepositMain.java

private void jobQueueMouseReleaseCommon(java.awt.event.MouseEvent evt, JTable table) {
    if (evt.isPopupTrigger()) {
        if (table.getSelectedRowCount() == 0) {
            int row = table.rowAtPoint(evt.getPoint());
            if (row > -1) {
                table.setRowSelectionInterval(row, row);
            }/* ww  w  . j  a v a  2s.  co  m*/
        }
        JPopupMenu menu = depositPresenter.getJobQueueMenu((JTable) evt.getSource());
        if (menu != null) {
            menu.show(evt.getComponent(), evt.getX(), evt.getY());
        }
    }
}

From source file:com.haulmont.cuba.desktop.gui.components.DesktopAbstractTable.java

protected void initComponent() {
    layout = new MigLayout("flowy, fill, insets 0", "", "[min!][fill]");
    panel = new JPanel(layout);

    topPanel = new JPanel(new BorderLayout());
    topPanel.setVisible(false);/*  ww w . j  av a2s .co m*/
    panel.add(topPanel, "growx");

    scrollPane = new JScrollPane(impl);
    impl.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    impl.setFillsViewportHeight(true);
    panel.add(scrollPane, "grow");

    impl.setShowGrid(true);
    impl.setGridColor(Color.lightGray);

    impl.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2) {
                handleClickAction();
            }
        }

        @Override
        public void mousePressed(MouseEvent e) {
            showPopup(e);
        }

        @Override
        public void mouseReleased(MouseEvent e) {
            showPopup(e);
        }

        protected void showPopup(MouseEvent e) {
            if (e.isPopupTrigger() && contextMenuEnabled) {
                // select row
                Point p = e.getPoint();
                int viewRowIndex = impl.rowAtPoint(p);

                int rowNumber;
                if (viewRowIndex >= 0) {
                    rowNumber = impl.convertRowIndexToModel(viewRowIndex);
                } else {
                    rowNumber = -1;
                }
                ListSelectionModel model = impl.getSelectionModel();

                if (!model.isSelectedIndex(rowNumber)) {
                    model.setSelectionInterval(rowNumber, rowNumber);
                }

                // show popup menu
                JPopupMenu popupMenu = createPopupMenu();
                if (popupMenu.getComponentCount() > 0) {
                    popupMenu.show(e.getComponent(), e.getX(), e.getY());
                }
            }
        }
    });

    ColumnControlButton columnControlButton = new ColumnControlButton(impl) {
        @Override
        protected ColumnVisibilityAction createColumnVisibilityAction(TableColumn column) {
            ColumnVisibilityAction columnVisibilityAction = super.createColumnVisibilityAction(column);

            columnVisibilityAction.addPropertyChangeListener(evt -> {
                if ("SwingSelectedKey".equals(evt.getPropertyName()) && evt.getNewValue() instanceof Boolean) {
                    ColumnVisibilityAction action = (ColumnVisibilityAction) evt.getSource();

                    String columnName = action.getActionCommand();
                    boolean collapsed = !((boolean) evt.getNewValue());

                    Column col = getColumn(columnName);
                    if (col != null) {
                        col.setCollapsed(collapsed);
                    }
                }
            });

            return columnVisibilityAction;
        }
    };
    impl.setColumnControl(columnControlButton);

    impl.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "enter");
    impl.getActionMap().put("enter", new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (enterPressAction != null) {
                enterPressAction.actionPerform(DesktopAbstractTable.this);
            } else {
                handleClickAction();
            }
        }
    });

    Messages messages = AppBeans.get(Messages.NAME);
    // localize default column control actions
    for (Object actionKey : impl.getActionMap().allKeys()) {
        if ("column.packAll".equals(actionKey)) {
            BoundAction action = (BoundAction) impl.getActionMap().get(actionKey);
            action.setName(messages.getMessage(DesktopTable.class, "DesktopTable.packAll"));
        } else if ("column.packSelected".equals(actionKey)) {
            BoundAction action = (BoundAction) impl.getActionMap().get(actionKey);
            action.setName(messages.getMessage(DesktopTable.class, "DesktopTable.packSelected"));
        } else if ("column.horizontalScroll".equals(actionKey)) {
            BoundAction action = (BoundAction) impl.getActionMap().get(actionKey);
            action.setName(messages.getMessage(DesktopTable.class, "DesktopTable.horizontalScroll"));
        }
    }

    // Ability to configure fonts in table
    // Add action to column control
    String configureFontsLabel = messages.getMessage(DesktopTable.class, "DesktopTable.configureFontsLabel");
    impl.getActionMap().put(ColumnControlButton.COLUMN_CONTROL_MARKER + "fonts",
            new AbstractAction(configureFontsLabel) {
                @Override
                public void actionPerformed(ActionEvent e) {
                    Component rootComponent = SwingUtilities.getRoot(impl);
                    final FontDialog fontDialog = FontDialog.show(rootComponent, impl.getFont());
                    fontDialog.addWindowListener(new WindowAdapter() {
                        @Override
                        public void windowClosed(WindowEvent e) {
                            Font result = fontDialog.getResult();
                            if (result != null) {
                                impl.setFont(result);
                                packRows();
                            }
                        }
                    });
                    fontDialog.open();
                }
            });

    // Ability to reset settings
    String resetSettingsLabel = messages.getMessage(DesktopTable.class, "DesktopTable.resetSettings");
    impl.getActionMap().put(ColumnControlButton.COLUMN_CONTROL_MARKER + "resetSettings",
            new AbstractAction(resetSettingsLabel) {
                @Override
                public void actionPerformed(ActionEvent e) {
                    resetPresentation();
                }
            });

    scrollPane.addComponentListener(new ComponentAdapter() {
        @Override
        public void componentResized(ComponentEvent e) {
            if (!columnsInitialized) {
                adjustColumnHeaders();
            }
            columnsInitialized = true;
        }
    });

    // init default row height
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            if (!fontInitialized) {
                applyFont(impl, impl.getFont());
            }
        }
    });
}

From source file:base.BasePlayer.BedCanvas.java

public void mouseMoved(MouseEvent event) {
    mouseY = event.getY();
    this.mouseX = event.getX();
    this.mouseRect.setBounds(event.getX() - Main.sidebarWidth, event.getY(), 1, 1);
    this.sideMouseRect.setBounds(event.getX(), event.getY(), 1, 1);

    if (!sidebar && event.getX() < Main.sidebarWidth) {
        sidebar = true;//  w  w w .ja  v a  2  s.c  o  m
    } else {
        if (sidebar && event.getX() >= Main.sidebarWidth) {
            sidebar = false;
        }
    }

    for (int i = 0; i < this.trackDivider.size(); i++) {
        if (this.trackDivider.get(i) * this.getHeight() < mouseY) {
            continue;
        }
        if (this.trackDivider.get(i) * this.getHeight() >= mouseY) {
            if (hoverIndex != i) {
                hoverIndex = i;
            }
            break;
        }
    }
    repaint();

}