Exemplo n.º 1
0
 /** Update the model when the user selects a color, and repaint the window. */
 public void valueChanged(ListSelectionEvent event) {
   Color color = view.getSelectedColor();
   model.setSelectedColor(color);
   view.repaint();
 }
Exemplo n.º 2
0
 /**
  * Add a point to the model when the user drags the mouse, and repaint the window. Need more logic
  * to draw solid lines.
  */
 public void mouseDragged(MouseEvent event) {
   Point point = event.getPoint(); // find point
   model.addPoint(point);
   view.repaint();
 } // end method mouseDragged