Logo Search packages:      
Sourcecode: wims version File versions  Download package

void GenericGraphApplet::setUpExampleMenu (  )  [inline, protected]

This method processes applet parameters that specify examples for the applet and adds them to a menu of examples. If any examples exist, they are placed in a menu and a panel is created to hold the menu. The panel is stored in the instance variable exampleMenuPanel, which is used in the setUpTopPanel() method. This method is called by init(). If you don't want to process examples, you could override it to do nothing. If you do want to process examples, you have to override the doLoadExample() method to process a string from the menu. Examples are specified in applet parameters named "Example", "Example1", "Example2", .... The value should consist of a name for the example (which appears in the menu) followed by a ";" followed by a string that defines the example. The string that defines the example is passed to the doLoadExample() method when the user loads the example.

Definition at line 383 of file GenericGraphApplet.java.

References exampleMenuPanel, and getParameter().

Referenced by setUpMainPanel().

      Vector strings = new Vector();
      Vector names = new Vector();
      int ct = 0;
      String paramName = "Example";
      String param = getParameter(paramName);
      if (param == null) {
         paramName = "Example" + ct;
         param = getParameter(paramName);
      while (true) {
         if (param == null)
         int pos = param.indexOf(';');
         if (pos < 0) {
         else {
         paramName = "Example" + ct;
         param = getParameter(paramName);
      if (strings.size() == 0)
      exampleStrings = strings;
      exampleMenuPanel = new JCMPanel();
      if ("yes".equalsIgnoreCase(getParameter("UseLoadButton","yes"))) {
         loadExampleButton = new Button("Load Example: ");
      Component list;
      if (names.size() == 1)
         list = new Label( (String)names.elementAt(0), Label.CENTER );
      else {
         exampleMenu = new Choice();
         list = exampleMenu;
         for (int i = 0; i < names.size(); i++)
            exampleMenu.add( (String)names.elementAt(i) );
         if (loadExampleButton == null)
      exampleMenuPanel.add(list, BorderLayout.CENTER);
      if (loadExampleButton != null)
         exampleMenuPanel.add(loadExampleButton, BorderLayout.WEST);

Generated by  Doxygen 1.6.0   Back to index