コード例 #1
0
 protected DrawingView createDrawingView(Drawing newDrawing) {
   Dimension d = getDrawingViewSize();
   DrawingView newDrawingView = new StandardDrawingView(this, d.width, d.height);
   newDrawingView.setDrawing(newDrawing);
   fireViewCreatedEvent(newDrawingView);
   return newDrawingView;
 }
コード例 #2
0
 /** Inserts a vector of figures and translates them by the given offset. */
 protected void insertFigures(Vector figures, int dx, int dy) {
   FigureEnumeration e = new FigureEnumerator(figures);
   while (e.hasMoreElements()) {
     Figure figure = e.nextFigure();
     figure.moveBy(dx, dy);
     figure = fView.add(figure);
     fView.addToSelection(figure);
   }
 }
コード例 #3
0
 /** Refreshes the drawing if there is some accumulated damage */
 public synchronized void checkDamage() {
   Iterator each = drawing().drawingChangeListeners();
   while (each.hasNext()) {
     Object l = each.next();
     if (l instanceof DrawingView) {
       ((DrawingView) l).repairDamage();
     }
   }
 }
コード例 #4
0
 /** Copies the selection to the clipboard. */
 protected void copySelection() {
   FigureSelection selection = fView.getFigureSelection();
   Clipboard.getClipboard().setContents(selection);
 }
コード例 #5
0
 /** Deletes the selection from the drawing. */
 protected void deleteSelection() {
   fView.drawing().removeAll(fView.selection());
   fView.clearSelection();
 }
コード例 #6
0
 /**
  * Creates the drawing view used in this application. You need to override this method to use a
  * DrawingView subclass in your application. By default a standard DrawingView is returned.
  */
 protected DrawingView createDrawingView() {
   DrawingView createdDrawingView = createDrawingView(createDrawing());
   createdDrawingView.drawing().setTitle(getDefaultDrawingTitle());
   return createdDrawingView;
 }