Пример #1
0
  protected JMenu createAnimationMenu() {
    CommandMenu menu = new CommandMenu("Animation");
    Command cmd =
        new AbstractCommand("Start Animation", this) {
          public void execute() {
            startAnimation();
          }
        };
    menu.add(cmd);

    cmd =
        new AbstractCommand("Stop Animation", this) {
          public void execute() {
            endAnimation();
          }
        };
    menu.add(cmd);
    return menu;
  }
Пример #2
0
 protected JMenu createImagesMenu() {
   CommandMenu menu = new CommandMenu("Images");
   File imagesDirectory = new File(fgSampleImagesPath);
   try {
     String[] list = imagesDirectory.list();
     for (int i = 0; i < list.length; i++) {
       String name = list[i];
       String path = fgSampleImagesResourcePath + name;
       menu.add(new UndoableCommand(new InsertImageCommand(name, path, this)));
     }
   } catch (Exception e) {
   }
   return menu;
 }
Пример #3
0
  protected JMenu createWindowMenu() {
    CommandMenu menu = new CommandMenu("Window");
    Command cmd =
        new AbstractCommand("New View", this) {
          public void execute() {
            newView();
          }
        };
    menu.add(cmd);

    cmd =
        new AbstractCommand("New Window", this, false) {
          public void execute() {
            newWindow(createDrawing());
          }
        };
    menu.add(cmd);

    menu.addSeparator();
    menu.add(new WindowMenu("Window List", (MDIDesktopPane) getDesktop(), this));

    return menu;
  }