@Override public void mouseDragged(MouseEvent e){
  if (m_mouseState == 1) {
    m_oldMousePos.width=m_newMousePos.width;
    m_oldMousePos.height=m_newMousePos.height;
    m_newMousePos.width=e.getX();
    m_newMousePos.height=e.getY();
    m_viewPos.width+=m_newMousePos.width - m_oldMousePos.width;
    m_viewPos.height+=m_newMousePos.height - m_oldMousePos.height;
  }
 else   if (m_mouseState == 3) {
    Graphics g=getGraphics();
    if (m_ZoomBoxColor == null) {
      g.setColor(Color.black);
    }
 else {
      g.setColor(m_ZoomBoxColor);
    }
    if (m_ZoomBoxXORColor == null) {
      g.setXORMode(Color.white);
    }
 else {
      g.setXORMode(m_ZoomBoxXORColor);
    }
    g.drawRect(m_oldMousePos.width,m_oldMousePos.height,m_newMousePos.width - m_oldMousePos.width,m_newMousePos.height - m_oldMousePos.height);
    m_newMousePos.width=e.getX();
    m_newMousePos.height=e.getY();
    g.drawRect(m_oldMousePos.width,m_oldMousePos.height,m_newMousePos.width - m_oldMousePos.width,m_newMousePos.height - m_oldMousePos.height);
    g.dispose();
  }
}

@ Override public void mouseDragged ( MouseEvent e ) { if ( m_mouseState == 1 ) { m_oldMousePos . width = m_newMousePos . width ; m_oldMousePos . height = m_newMousePos . height ; m_newMousePos . width = e . getX ( ) ; m_newMousePos . height = e . getY ( ) ; m_viewPos . width += m_newMousePos . width - m_oldMousePos . width ; m_viewPos . height += m_newMousePos . height - m_oldMousePos . height ; } else if ( m_mouseState == 3 ) { Graphics g = getGraphics ( ) ; if ( m_ZoomBoxColor == null ) { g . setColor ( Color . black ) ; } else { g . setColor ( m_ZoomBoxColor ) ; } if ( m_ZoomBoxXORColor == null ) { g . setXORMode ( Color . white ) ; } else { g . setXORMode ( m_ZoomBoxXORColor ) ; } g . drawRect ( m_oldMousePos . width , m_oldMousePos . height , m_newMousePos . width - m_oldMousePos . width , m_newMousePos . height - m_oldMousePos . height ) ; m_newMousePos . width = e . getX ( ) ; m_newMousePos . height = e . getY ( ) ; g . drawRect ( m_oldMousePos . width , m_oldMousePos . height , m_newMousePos . width - m_oldMousePos . width , m_newMousePos . height - m_oldMousePos . height ) ; g . dispose ( ) ; } }
performs intermediate updates to what the user wishes to do .
