Class StompDraw.DrawPanel

All Implemented Interfaces:
MouseMotionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible
Enclosing class:
StompDraw

private class StompDraw.DrawPanel extends JPanel implements MouseMotionListener
  • Field Details

  • Constructor Details

    • DrawPanel

      public DrawPanel(boolean use_state)
  • Method Details

    • writeState

      public void writeState(OutputStream outstream) throws IOException
      Throws:
      IOException
    • readState

      public void readState(InputStream instream) throws IOException
      Throws:
      IOException
    • createOffscreenImage

      final void createOffscreenImage(boolean discard_image)
    • mouseMoved

      public void mouseMoved(MouseEvent e)
      Specified by:
      mouseMoved in interface MouseMotionListener
    • mouseDragged

      public void mouseDragged(MouseEvent e)
      Specified by:
      mouseDragged in interface MouseMotionListener
    • drawPoint

      public void drawPoint(DrawCommand c)
      Adds pixel to queue and calls repaint() whenever we have MAX_ITEMS pixels in the queue or when MAX_TIME msecs have elapsed (whichever comes first). The advantage compared to just calling repaint() after adding a pixel to the queue is that repaint() can most often draw multiple points at the same time.
    • clear

      public void clear()
    • drawState

      public void drawState()
      Draw the entire panel from the state
    • getPreferredSize

      public Dimension getPreferredSize()
      Overrides:
      getPreferredSize in class JComponent
    • paintComponent

      public void paintComponent(Graphics g)
      Overrides:
      paintComponent in class JComponent