private void addPathListener (final GridButton gButton) {
        MouseAdapter listener = new MouseAdapter() {

            @Override
            public void mouseClicked (MouseEvent e) {
                if (SwingUtilities.isLeftMouseButton(e)) {
                    isPath = !isPath;
                    if (isPath) {
                        myGrid.addPathCoordinate(myCoordinate);
                        setImage();
                        myGrid.addPathCoordinate(myCoordinate);
                    }
                    else {
                        myGrid.removePathCoordinate(myCoordinate);
                        gButton.setIcon(null);
                    }
                }
                if (SwingUtilities.isRightMouseButton(e)) {
                    myPopupMenu = new JPopupMenu();
                    myStartOptionItem =
                            new JMenuItem(
                                          StyleConstants.resourceBundle
                                                  .getString("GridButtonStartMessage"));
                    myStartOptionItem.addMouseListener(new MouseAdapter() {
                        public void mousePressed (MouseEvent me) {
                            myGrid.setPathStart(myCoordinate);
                        }
                    });
                    myEndOptionItem =
                            new JMenuItem(
                                          StyleConstants.resourceBundle
                                                  .getString("GridButtonEndMessage"));
                    myEndOptionItem.addMouseListener(new MouseAdapter() {
                        public void mousePressed (MouseEvent me) {
                            myGrid.setPathEnd(myCoordinate);
                        }
                    });
                    myPopupMenu.add(myStartOptionItem);
                    myPopupMenu.add(myEndOptionItem);
                    myStartOptionItem.addActionListener(new ActionListener() {
                        public void actionPerformed (ActionEvent e) {
                        }
                    });
                    gButton.addMouseListener(new MouseAdapter() {
                        public void mousePressed (MouseEvent me) {
                            if (me.isPopupTrigger()) {
                                myPopupMenu.show(me.getComponent(), me.getX(), me.getY());
                            }
                        }

                        public void mouseReleased (MouseEvent Me) {
                            if (Me.isPopupTrigger()) {
                                myPopupMenu.show(Me.getComponent(), Me.getX(), Me.getY());
                            }
                        }
                    });
                }
            }
        };
        gButton.addMouseListener(listener);
    }