Exemplo n.º 1
0
 /**
  * Dessine le JPanel en listant les proglets
  *
  * @see ProgletEngine
  * @return Le JPanel dessiné
  */
 private static JPanel shortcutPanel() {
   JPanel shortcuts = new JPanel();
   int i = 0;
   for (Proglet proglet : ProgletEngine.getInstance().getProglets()) i++;
   shortcuts.setLayout(new GridLayout(0, (i / 3) == 0 ? 1 : (i / 3)));
   for (Proglet proglet : ProgletEngine.getInstance().getProglets())
     shortcuts.add(
         JVSStartPanel.createShortcut(
             Macros.getIcon(proglet.getIcon()),
             proglet.getName(),
             proglet.getTitle(),
             new ProgletLoader(proglet.getName())));
   return shortcuts;
 }
Exemplo n.º 2
0
  /** Initialize la barre d'outils en créant les bouttons */
  private void init() {
    if (ProgletEngine.getInstance().getProgletCount() > 1)
      addTool(
          "Nouvelle activité",
          "org/javascool/widgets/icons/new.png",
          new Runnable() {
            @Override
            public void run() {
              JVSPanel.getInstance().closeProglet();
            }
          });
    addTool(
        "Nouveau fichier",
        "org/javascool/widgets/icons/new.png",
        new Runnable() {
          @Override
          public void run() {
            JVSPanel.getInstance().newFile();
          }
        });
    addTool(
        "Ouvrir un fichier",
        "org/javascool/widgets/icons/open.png",
        new Runnable() {
          @Override
          public void run() {
            JVSPanel.getInstance().openFile();
          }
        });
    addTool(
        "Sauver",
        "org/javascool/widgets/icons/save.png",
        new Runnable() {
          @Override
          public void run() {
            JVSPanel.getInstance().saveFile();
          }
        });
    {
      JPopupMenu menu = addTool("Sauver en ...", "org/javascool/widgets/icons/saveas.png");
      JLabel l = new JLabel("Sauvegarde du fichier Java'sCool courant:");
      l.setIcon(Macros.getIcon("org/javascool/widgets/icons/saveas.png"));
      menu.add(l);
      menu.add("   .. en javascool (.jvs)")
          .addActionListener(
              new ActionListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void actionPerformed(ActionEvent e) {
                  JVSPanel.getInstance().saveAsFile();
                }
              });
      menu.add("   .. source forme de source java (.java)")
          .addActionListener(
              new ActionListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void actionPerformed(ActionEvent e) {
                  new Thread(
                          new Runnable() {
                            public void run() {
                              JVSPanel.getInstance().saveAsJavaFile();
                            }
                          })
                      .start();
                }
              });
      menu.add("   .. sous forme exécutable (.jar)")
          .addActionListener(
              new ActionListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void actionPerformed(ActionEvent e) {
                  new Thread(
                          new Runnable() {
                            public void run() {
                              JVSPanel.getInstance().saveAsJarFile();
                            }
                          })
                      .start();
                }
              });
    }

    compileButton =
        addTool(
            "Compiler",
            "org/javascool/widgets/icons/compile.png",
            new Runnable() {
              @Override
              public void run() {
                JVSPanel.getInstance().compileFile();
              }
            });

    addTool(
        "Executer",
        runButton =
            new StartStopButton() {
              private static final long serialVersionUID = 1L;

              @Override
              public void start() {
                JVSWidgetPanel.getInstance().focusOnProgletPanel();
                ProgletEngine.getInstance().doRun();
              }

              @Override
              public void stop() {
                ProgletEngine.getInstance().doStop();
              }

              @Override
              public boolean isRunning() {
                return ProgletEngine.getInstance().isRunning();
              }
            });
    runButton.setVisible(false);
    /*
    this.demoButton = addTool("Demo", "org/javascool/widgets/icons/play.png", new Runnable() {
                                @Override
                                public void run() {
                                  JVSWidgetPanel.getInstance().focusOnProgletPanel();
                                  ProgletEngine.getInstance().getProglet().doDemo();
                                }
                              }
                              );
    demoButton.setVisible(false);
    */
    /* Crée le menu de construction de proglets si pertinent
    if(ProgletsBuilder.canBuildProglets()) {
      pbutton = addRightTool("Proglet Builder", new Runnable() {
                               @Override
                               public void run() {
                                 DialogFrame.startFrame();
                               }
                             }
                             );
    }*/
    this.add(About.getAboutMessage(), 0);
    revalidate();
    repaint();
  }