/// <summary>
        /// Responds to mouse dragged events by moving around the box representing
        /// the viewable network area, and also making the large network display change to show that area. </summary>
        /// <param name="event"> the MouseEvent that happened. </param>
        public virtual void mouseDragged(MouseEvent @event)
        {
            if (__inDrag)
            {
                if (@event.getX() < __leftX || @event.getX() > __leftX + __totalWidth)
                {
                    return;
                }
                if (@event.getY() < __bottomY || @event.getY() > __bottomY + __totalHeight)
                {
                    return;
                }

                __inDrag = true;
                GRLimits data = __networkJComponent.getTotalDataLimits();

                int    width  = __totalWidth;
                double pct    = (double)(@event.getX() - __leftX) / (double)width;
                int    nw     = (int)data.getWidth();
                int    xPoint = (int)((nw * pct) + data.getLeftX());

                int height = __totalHeight;
                pct = (double)(height - @event.getY() + __bottomY) / (double)height;
                int nh     = (int)data.getHeight();
                int yPoint = (int)((nh * pct) + data.getBottomY());

                int x = xPoint - __xAdjust;
                int y = yPoint - __yAdjust;
                __networkJComponent.setViewPosition(x, y);
            }
        }
        /// <summary>
        /// Converts an X value from being scaled for drawing units to be scaled for data units. </summary>
        /// <param name="x"> the x value to scale. </param>
        /// <returns> the x value scaled to fit in the data units. </returns>
        public virtual double convertX(double x)
        {
            GRLimits data = __drawingArea.getDataLimits();
            GRLimits draw = __drawingArea.getDrawingLimits();
            double   newX = (data.getLeftX() + (x / draw.getWidth()) * data.getWidth());

            return(newX);
        }
        /// <summary>
        /// Responds to mouse pressed events.  If the mouse was clicked within the box that
        /// represents the viewable network area, then that view can be dragged around and
        /// will be represented in the large display.  Otherwise, the view is re-centered
        /// around the mouse click point. </summary>
        /// <param name="event"> the MouseEvent that happened. </param>
        public virtual void mousePressed(MouseEvent @event)
        {
            if (@event.getX() < __leftX || @event.getX() > __leftX + __totalWidth)
            {
                return;
            }
            if (@event.getY() < __bottomY || @event.getY() > __bottomY + __totalHeight)
            {
                return;
            }
            __inDrag = true;

            GRLimits data   = __networkJComponent.getTotalDataLimits();
            int      width  = __totalWidth;
            double   pct    = (double)(@event.getX() - __leftX) / (double)width;
            int      nw     = (int)data.getWidth();
            int      xPoint = (int)((nw * pct) + data.getLeftX());

            int height = __totalHeight;

            pct = (double)(height - @event.getY() + __bottomY) / (double)height;
            int      nh     = (int)data.getHeight();
            int      yPoint = (int)((nh * pct) + data.getBottomY());
            GRLimits limits = __networkJComponent.getVisibleDataLimits();

            int lx = (int)limits.getLeftX();
            int by = (int)limits.getBottomY();
            int rx = (int)limits.getRightX();
            int ty = (int)limits.getTopY();
            int w  = rx - lx;
            int h  = ty - by;

            // If the mouse was clicked in a point outside of the display box,
            // the box is re-centered on the point and the network display is updated to show that area
            __xAdjust = (w / 2);
            __yAdjust = (h / 2);
            int x = xPoint - __xAdjust;
            int y = yPoint - __yAdjust;

            __networkJComponent.setViewPosition(x, y);
        }
        /// <summary>
        /// Draws the outline of the legend.
        /// </summary>
        public virtual void drawLegend()
        {
            GRLimits l = __networkJComponent.getLegendDataLimits();

            if (l == null)
            {
                return;
            }
            GRDrawingAreaUtil.setColor(__drawingArea, GRColor.white);
            double lx = l.getLeftX();
            double by = l.getBottomY();
            double rx = l.getRightX();
            double ty = l.getTopY();

            GRDrawingAreaUtil.fillRectangle(__drawingArea, lx, by, l.getWidth(), l.getHeight());
            GRDrawingAreaUtil.setColor(__drawingArea, GRColor.black);
            GRDrawingAreaUtil.drawLine(__drawingArea, lx, by, rx, by);
            GRDrawingAreaUtil.drawLine(__drawingArea, lx, ty, rx, ty);
            GRDrawingAreaUtil.drawLine(__drawingArea, lx, by, lx, ty);
            GRDrawingAreaUtil.drawLine(__drawingArea, rx, by, rx, ty);
        }