Rectangle viewArea = mainPanel.getViewportBorderBounds();
Rectangle viewArea = mainPanel.getViewport().getBounds();
    public void paint(Graphics g) {        if (myView != null) {            myView.paint(g);        }        if (mainPanel != null) {            g.setColor(Color.yellow);            Rectangle viewArea = mainPanel.getViewportBorderBounds();            if (viewArea != null) {                g.drawRect(                        (int)((viewArea.x-1) * scale),                        (int)((viewArea.y-1) * scale),                        (int)(viewArea.width * scale),                        (int)(viewArea.height * scale));            }        }    }