SHARE
TWEET

Untitled

AishaAli Nov 19th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  /*
  2.  @(#)FigureTransferCommand.java 5.2
  3.   */
  4.  
  5. package CH.ifa.draw.standard;
  6.  
  7. import java.util.*;
  8. import CH.ifa.draw.util.*;
  9. import CH.ifa.draw.framework.*;
  10.  
  11. abstract class FigureTransferCommand extends Command {
  12.  
  13.     protected DrawingView fView;
  14.  
  15.     protected FigureTransferCommand(String name, DrawingView view) {
  16.         super(name);
  17.         fView = view;
  18.     }
  19.     protected void deleteSelection() {
  20.        fView.drawing().removeAll(fView.selection());
  21.        fView.clearSelection();
  22.     }
  23.  
  24.     protected void copySelection() {
  25.         FigureSelection selection = fView.getFigureSelection();
  26.         Clipboard.getClipboard().setContents(selection);
  27.     }
  28.  
  29.     protected void insertFigures(Vector figures, int dx, int dy) {
  30.         FigureEnumeration e = new FigureEnumerator(figures);
  31.         while (e.hasMoreElements()) {
  32.             Figure figure = e.nextFigure();
  33.             figure.moveBy(dx, dy);
  34.             figure = fView.add(figure);
  35.             fView.addToSelection(figure);
  36.         }
  37.     }
  38.  
  39. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top