Esempio n. 1
0
  //
  //  Initialize the GUI (application and applet)
  //
  public void initialize(String[] args) {
    // Initialize the window, menubar, etc.
    super.initialize(args);
    exampleFrame.setTitle("Java 3D Light Scoping Example");

    //
    //  Add a menubar menu to change node parameters
    //    Use bounding leaf
    //

    Menu m = new Menu("DirectionalLights");

    light1OnOffMenu = new CheckboxMenuItem("Red light with sphere set 1 scope", light1OnOff);
    light1OnOffMenu.addItemListener(this);
    m.add(light1OnOffMenu);

    light2OnOffMenu = new CheckboxMenuItem("Blue light with sphere set 2 scope", light2OnOff);
    light2OnOffMenu.addItemListener(this);
    m.add(light2OnOffMenu);

    light3OnOffMenu = new CheckboxMenuItem("White light with universal scope", light3OnOff);
    light3OnOffMenu.addItemListener(this);
    m.add(light3OnOffMenu);

    exampleMenuBar.add(m);
  }
Esempio n. 2
0
  public MenuFrame(String title) {
    super(title);
    this.m_file = new Menu("File");
    this.m_edit = new Menu("Edit");
    this.cm_debug = new CheckboxMenuItem("Debug");
    this.cm_test = new CheckboxMenuItem("Test");
    this.p_debug = new Panel();

    MenuFrameListener listener = new MenuFrameListener();

    Menu m_sub = new Menu("Additional");
    MenuItem mi_new = new MenuItem("New...");
    MenuItem mi_open = new MenuItem("Open...");
    MenuItem mi_close = new MenuItem("Close...");
    MenuItem mi_cut = new MenuItem("Cut");
    MenuItem mi_copy = new MenuItem("Copy");
    MenuItem mi_paste = new MenuItem("Paste");
    MenuItem mi_one = new MenuItem("One!");
    MenuItem mi_two = new MenuItem("Two!");
    MenuItem mi_three = new MenuItem("Three!");

    mi_new.addActionListener(listener);
    mi_open.addActionListener(listener);
    mi_close.addActionListener(listener);
    mi_cut.addActionListener(listener);
    mi_copy.addActionListener(listener);
    mi_paste.addActionListener(listener);
    mi_one.addActionListener(listener);
    mi_two.addActionListener(listener);
    mi_three.addActionListener(listener);
    cm_debug.addItemListener(listener);
    cm_test.addItemListener(listener);

    m_sub.add(mi_one);
    m_sub.add(mi_two);
    m_sub.add(mi_three);
    m_file.add(mi_open);
    m_file.add(mi_new);
    m_file.add(mi_close);
    m_edit.add(mi_cut);
    m_edit.add(mi_copy);
    m_edit.add(mi_paste);
    m_edit.add(m_sub);
    m_edit.add(cm_test);
    m_edit.add(cm_debug);

    initWindow();
  }
Esempio n. 3
0
  //
  //  Handle checkboxes and menu choices
  //
  public void itemStateChanged(ItemEvent event) {
    Object src = event.getSource();
    if (src == light1OnOffMenu) {
      light1OnOff = light1OnOffMenu.getState();
      light1.setEnable(light1OnOff);
      return;
    }
    if (src == light2OnOffMenu) {
      light2OnOff = light2OnOffMenu.getState();
      light2.setEnable(light2OnOff);
      return;
    }
    if (src == light3OnOffMenu) {
      light3OnOff = light3OnOffMenu.getState();
      light3.setEnable(light3OnOff);
      return;
    }

    // Handle all other checkboxes
    super.itemStateChanged(event);
  }
Esempio n. 4
0
 /**
  * Sets the SNMP version to use.
  *
  * @param version the new version number
  */
 public void setSnmpVersion(int version) {
   snmpV1Item.setState(false);
   snmpV2Item.setState(false);
   snmpV3Item.setState(false);
   if (version == 1) {
     snmpV1Item.setState(true);
   } else if (version == 2) {
     snmpV2Item.setState(true);
   } else if (version == 3) {
     snmpV3Item.setState(true);
   }
   snmpPanel.setVersion(version);
 }
Esempio n. 5
0
  public void itemStateChanged(ItemEvent event) {
    Object src = event.getSource();

    // Check if it is the coupled background choice
    if (src == coupledBackgroundOnOffMenu) {
      coupledBackgroundOnOff = coupledBackgroundOnOffMenu.getState();
      if (coupledBackgroundOnOff) {
        currentBackgroundColor = currentColor;
        backgroundColorMenu.setCurrent(currentColor);
        Color3f color = (Color3f) colors[currentColor].value;
        background.setColor(color);
        backgroundColorMenu.setEnabled(false);
      } else {
        backgroundColorMenu.setEnabled(true);
      }
    }

    // Handle all other checkboxes
    super.itemStateChanged(event);
  }
    public void itemStateChanged(ItemEvent event) {
      CheckboxMenuItem theMenuItem = (CheckboxMenuItem) (event.getSource());

      String strIndex =
          theMenuItem
              .getActionCommand()
              .substring(theMenuItem.getActionCommand().lastIndexOf('.') + 1);
      int index = (new Integer(strIndex)).intValue();
      if (theMenuItem.getState()) {
        ((Component) visibleMapLayers.elementAt(index)).setVisible(true);
      } else {
        ((Component) visibleMapLayers.elementAt(index)).setVisible(false);
      }

      System.out.println("Action = " + theMenuItem.getActionCommand());
      System.out.println("       = " + theMenuItem.getState());
    }
Esempio n. 7
0
  //
  //  Initialize the GUI (application and applet)
  //
  public void initialize(String[] args) {
    // Initialize the window, menubar, etc.
    super.initialize(args);
    exampleFrame.setTitle("Java 3D LinearFog Example");

    //
    //  Add a menubar menu to change node parameters
    //    Coupled background color
    //    Background color -->
    //    Fog color -->
    //    Fog front distance -->
    //    Fog back distance -->
    //

    Menu m = new Menu("LinearFog");

    coupledBackgroundOnOffMenu =
        new CheckboxMenuItem("Couple background color", coupledBackgroundOnOff);
    coupledBackgroundOnOffMenu.addItemListener(this);
    m.add(coupledBackgroundOnOffMenu);

    backgroundColorMenu =
        new CheckboxMenu("Background color", colors, currentBackgroundColor, this);
    m.add(backgroundColorMenu);
    backgroundColorMenu.setEnabled(!coupledBackgroundOnOff);

    colorMenu = new CheckboxMenu("Fog color", colors, currentColor, this);
    m.add(colorMenu);

    frontMenu = new CheckboxMenu("Fog front distance", fronts, currentFront, this);
    m.add(frontMenu);

    backMenu = new CheckboxMenu("Fog back distance", backs, currentBack, this);
    m.add(backMenu);

    exampleMenuBar.add(m);
  }
Esempio n. 8
0
  /** Initializes the frame menu. */
  private void initializeMenu() {
    Menu menu;
    MenuItem item;

    // Create file menu
    menu = new Menu("File");
    item = new MenuItem("Load MIB...", new MenuShortcut(KeyEvent.VK_O));
    item.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            loadMib();
          }
        });
    menu.add(item);
    item = new MenuItem("Unload MIB", new MenuShortcut(KeyEvent.VK_W));
    item.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            unloadMib();
          }
        });
    menu.add(item);
    item = new MenuItem("Unload All");
    item.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            unloadAllMibs();
          }
        });
    menu.add(item);
    if (!MacUIHelper.IS_MAC_OS) {
      menu.addSeparator();
      item = new MenuItem("Exit", new MenuShortcut(KeyEvent.VK_Q));
      item.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              quit();
            }
          });
      menu.add(item);
    }
    menuBar.add(menu);

    // Create Edit menu
    menu = new Menu("Edit");
    item = new MenuItem("Cut", new MenuShortcut(KeyEvent.VK_X));
    item.addActionListener(new DefaultEditorKit.CutAction());
    menu.add(item);
    item = new MenuItem("Copy", new MenuShortcut(KeyEvent.VK_C));
    item.addActionListener(new DefaultEditorKit.CopyAction());
    menu.add(item);
    item = new MenuItem("Paste", new MenuShortcut(KeyEvent.VK_V));
    item.addActionListener(new DefaultEditorKit.PasteAction());
    menu.add(item);
    item = new MenuItem("Select All", new MenuShortcut(KeyEvent.VK_A));
    item.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager();
            Component comp = kfm.getFocusOwner();
            if (comp instanceof TextComponent) {
              ((TextComponent) comp).selectAll();
            } else if (comp instanceof JTextComponent) {
              ((JTextComponent) comp).selectAll();
            }
          }
        });
    menu.add(item);
    menuBar.add(menu);

    // Create SNMP menu
    menu = new Menu("SNMP");
    snmpV1Item.setState(true);
    snmpV1Item.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            setSnmpVersion(1);
          }
        });
    menu.add(snmpV1Item);
    snmpV2Item.setState(false);
    snmpV2Item.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            setSnmpVersion(2);
          }
        });
    menu.add(snmpV2Item);
    snmpV3Item.setState(false);
    snmpV3Item.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            setSnmpVersion(3);
          }
        });
    menu.add(snmpV3Item);
    menu.addSeparator();
    CheckboxMenuItem checkBox = new CheckboxMenuItem("Show result in tree");
    checkBox.setState(true);
    checkBox.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            setSnmpFeedback(e.getStateChange() == ItemEvent.SELECTED);
          }
        });
    menu.add(checkBox);
    menuBar.add(menu);

    // Create help menu
    menu = new Menu("Help");
    item = new MenuItem("License...");
    item.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            showLicense();
          }
        });
    menu.add(item);
    if (!MacUIHelper.IS_MAC_OS) {
      item = new MenuItem("About...");
      item.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              showAbout();
            }
          });
      menu.add(item);
    }
    menuBar.add(menu);

    // Fix Mac OS specific menus
    if (MacUIHelper.IS_MAC_OS) {
      @SuppressWarnings("unused")
      Object tmp = new MacUIHelper(this);
    }
  }
Esempio n. 9
0
  private void init(final SettingsUI settingsUI) throws AWTException {
    SystemTray tray = SystemTray.getSystemTray();

    PopupMenu popup = new PopupMenu();

    final CheckboxMenuItem ftpItem = new CheckboxMenuItem(" Ftp ");
    final CheckboxMenuItem picasawebItem = new CheckboxMenuItem(" Picasaweb ");

    ftpItem.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            Settings.getInstance().setPicasawebMode(false);
            Settings.getInstance().save();
            start();
          }
        });
    popup.add(ftpItem);

    picasawebItem.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            Settings.getInstance().setPicasawebMode(true);
            Settings.getInstance().save();
            start();
          }
        });
    popup.add(picasawebItem);

    checkMenuItem(picasawebItem, ftpItem, Settings.getInstance().isPicasawebMode());

    MenuItem settingsItem = new MenuItem(" Settings ");
    settingsItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            settingsUI.open(mousePoint);
          }
        });
    popup.add(settingsItem);

    MenuItem exitItem = new MenuItem(" Exit ");
    exitItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            System.out.println("Exiting...");
            System.exit(0);
          }
        });
    popup.add(exitItem);

    URL imgURL = getClass().getClassLoader().getResource("icon.png");
    final TrayIcon trayIcon = new TrayIcon(new ImageIcon(imgURL).getImage(), "Screenshot", popup);

    trayIcon.setImageAutoSize(true);
    trayIcon.addMouseListener(
        new MouseAdapter() {
          public void mousePressed(MouseEvent e) {
            checkMenuItem(picasawebItem, ftpItem, Settings.getInstance().isPicasawebMode());
          }

          public void mouseClicked(MouseEvent e) {
            mousePoint = e.getPoint();
            if (e.getButton() == BUTTON1) {
              start();
            }
          }
        });

    tray.add(trayIcon);
  }
Esempio n. 10
0
 private void checkMenuItem(
     CheckboxMenuItem picasawebItem, CheckboxMenuItem ftpItem, boolean picasawebMode) {
   picasawebItem.setState(picasawebMode);
   ftpItem.setState(!picasawebMode);
 }
Esempio n. 11
0
  private static void createAndShowGUI() {
    // Check the SystemTray support
    if (!SystemTray.isSupported()) {
      System.out.println("SystemTray is not supported");
      return;
    }
    final PopupMenu popup = new PopupMenu();
    final TrayIcon trayIcon =
        new TrayIcon(ImageHelper.loadImage("/images/splash.jpg", "tray icon"));
    final SystemTray tray = SystemTray.getSystemTray();

    // Create a popup menu components
    MenuItem aboutItem = new MenuItem("About");
    CheckboxMenuItem cb1 = new CheckboxMenuItem("Set auto size");
    CheckboxMenuItem cb2 = new CheckboxMenuItem("Set tooltip");
    Menu displayMenu = new Menu("Display");
    MenuItem errorItem = new MenuItem("Error");
    MenuItem warningItem = new MenuItem("Warning");
    MenuItem infoItem = new MenuItem("Info");
    MenuItem noneItem = new MenuItem("None");
    MenuItem exitItem = new MenuItem("Exit");

    // Add components to popup menu
    popup.add(aboutItem);
    popup.addSeparator();
    popup.add(cb1);
    popup.add(cb2);
    popup.addSeparator();
    popup.add(displayMenu);
    displayMenu.add(errorItem);
    displayMenu.add(warningItem);
    displayMenu.add(infoItem);
    displayMenu.add(noneItem);
    popup.add(exitItem);

    trayIcon.setPopupMenu(popup);

    try {
      tray.add(trayIcon);
    } catch (AWTException e) {
      System.out.println("TrayIcon could not be added.");
      return;
    }

    trayIcon.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            JOptionPane.showMessageDialog(null, "This dialog box is run from System Tray");
          }
        });

    aboutItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            JOptionPane.showMessageDialog(null, "This dialog box is run from the About menu item");
          }
        });

    cb1.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            int cb1Id = e.getStateChange();
            if (cb1Id == ItemEvent.SELECTED) {
              trayIcon.setImageAutoSize(true);
            } else {
              trayIcon.setImageAutoSize(false);
            }
          }
        });

    cb2.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            int cb2Id = e.getStateChange();
            if (cb2Id == ItemEvent.SELECTED) {
              trayIcon.setToolTip("Sun TrayIcon");
            } else {
              trayIcon.setToolTip(null);
            }
          }
        });

    ActionListener listener =
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            MenuItem item = (MenuItem) e.getSource();
            // TrayIcon.MessageType type = null;
            System.out.println(item.getLabel());
            if ("Error".equals(item.getLabel())) {
              // type = TrayIcon.MessageType.ERROR;
              trayIcon.displayMessage(
                  "Sun TrayIcon Demo", "This is an error message", TrayIcon.MessageType.ERROR);

            } else if ("Warning".equals(item.getLabel())) {
              // type = TrayIcon.MessageType.WARNING;
              trayIcon.displayMessage(
                  "Sun TrayIcon Demo", "This is a warning message", TrayIcon.MessageType.WARNING);

            } else if ("Info".equals(item.getLabel())) {
              // type = TrayIcon.MessageType.INFO;
              trayIcon.displayMessage(
                  "Sun TrayIcon Demo", "This is an info message", TrayIcon.MessageType.INFO);

            } else if ("None".equals(item.getLabel())) {
              // type = TrayIcon.MessageType.NONE;
              trayIcon.displayMessage(
                  "Sun TrayIcon Demo", "This is an ordinary message", TrayIcon.MessageType.NONE);
            }
          }
        };

    errorItem.addActionListener(listener);
    warningItem.addActionListener(listener);
    infoItem.addActionListener(listener);
    noneItem.addActionListener(listener);

    exitItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            tray.remove(trayIcon);
            System.exit(0);
          }
        });
  }
Esempio n. 12
0
  public boolean handleEvent(Event event) {
    if (event.target instanceof ScrolledPanel) {
      if (event.id == ScrolledPanel.RESIZE)
      // RESIZE event from panel.
      {
        DDimension tmp_dim;

        tmp_dim = viewingPanel_.getPortSize();
        portScroller_.setPortSize(tmp_dim.width, tmp_dim.height);

        tmp_dim = viewingPanel_.getContentSize();
        portScroller_.setContentSize(tmp_dim.width, tmp_dim.height);

        tmp_dim = viewingPanel_.getOffset();
        portScroller_.setOffset(tmp_dim.width, tmp_dim.height);

        return true;
      } else if (event.id == ScrolledPanel.OFFSET) {
        DDimension tmp_dim = viewingPanel_.getOffset();
        portScroller_.setOffset(tmp_dim.width, tmp_dim.height);

        return true;
      }
    } else if (event.target instanceof ViewportScroller) {
      if (event.id == ViewportScroller.SCROLL) {
        graphCanvas_.setWireframe(true);
        viewingPanel_.scrollTo((int) portScroller_.getOffsetX(), (int) portScroller_.getOffsetY());
      }
      if (event.id == ViewportScroller.DONE) {
        graphCanvas_.setWireframe(false);
        viewingPanel_.scrollTo((int) portScroller_.getOffsetX(), (int) portScroller_.getOffsetY());
      }
    } else if (event.target instanceof AngleControlPanel) {
      if (event.id == AngleControlPanel.ANGLE) {
        DPoint angles = (DPoint) event.arg;

        graphCanvas_.setWireframe(true);
        graphCanvas_.setViewAngles(angles.x, angles.y);
      }
      if (event.id == AngleControlPanel.DONE) {
        DPoint angles = (DPoint) event.arg;

        graphCanvas_.setWireframe(false);
        graphCanvas_.setViewAngles(angles.x, angles.y);
      }
    } else if (event.target instanceof GraphCanvas)
    // Graph has changed.
    {
      if (event.id == GraphCanvas.UPDATE) {
        cbmiDirected_.setState(graph_.isDirected());
      }
    }
    // quit from Window Manager menu
    else if (event.id == Event.WINDOW_DESTROY) {
      Destroy();
      return false;
    }

    // call inherited handler
    return super.handleEvent(event);
  }
Esempio n. 13
0
  private void construct(Graph graph_in) {
    algHashTable_ = new Hashtable();
    algNameHashTable_ = new Hashtable();
    menuHashTable_ = new Hashtable();
    boolean emptyGraph = true;
    if (graph_in != null && graph_in.numberOfNodes() > 0) {
      emptyGraph = false;
    }

    // create menus

    boolean directed = graph_in.isDirected();

    MenuBar menubar = new MenuBar();
    Menu menu = new Menu("File");

    menu.add(new MenuItem("Open (GML)"));
    menu.add(new MenuItem("Save (GML)"));
    menu.add(new MenuItem("Save As (GML)"));

    menu.add(new MenuItem("-"));
    menu.add(new MenuItem("Open Example Graph"));
    menu.add(new MenuItem("-"));
    menu.add(new MenuItem("PostScript Output"));

    menu.add(new MenuItem("-"));
    menu.add(new MenuItem("Exit This Window"));
    menu.add(new MenuItem("Exit Application (and COUGAAR Node)"));

    menubar.add(menu);

    algorithmMenu_ = new Menu("Algorithms");
    menubar.add(algorithmMenu_);

    menu = new Menu("Edit");
    menu.add(new MenuItem("Edit Text Representation (GML)"));
    menu.add(new MenuItem("Delete Selected Items"));
    menu.add(new MenuItem("Select All"));
    menu.add(new MenuItem("Remove All Edge Bends"));
    menu.add(new MenuItem("Remove All Groups"));
    menu.add(new MenuItem("Group Control"));
    menubar.add(menu);

    menu = new Menu("Properties");

    showControls_ = new CheckboxMenuItem("Show Controls  [s]");
    showControls_.setState(true);
    // showControls_.setState(false);
    menu.add(showControls_);

    CheckboxMenuItem cbmi = new CheckboxMenuItem("Directed");
    cbmiDirected_ = cbmi;
    if (directed) cbmi.setState(true);
    menu.add(cbmi);

    menu.add(new MenuItem("Set New Node Properties"));
    menu.add(new MenuItem("Set Node Spacing"));
    menu.add(new MenuItem("Set Font"));

    cbmi = new CheckboxMenuItem("Scale Node Size");
    cbmi.setState(true);
    menu.add(cbmi);

    cbmi = new CheckboxMenuItem("Use Node ID As Default Label");
    cbmi.setState(true);
    menu.add(cbmi);

    cbmi = new CheckboxMenuItem("High Quality Display");
    // cbmi.setState(false);
    cbmi.setState(true);
    menu.add(cbmi);

    menubar.add(menu);

    setMenuBar(menubar);

    setLayout(new BorderLayout());

    // panel for controls

    LPanel p = new LPanel();
    LPanel smallPanel = new LPanel(); // mod
    LPanel p1 = new LPanel(); // mod
    // let's try this
    p1.setLayout(new FlowLayout()); // mod

    p1.addButton("Update", 1, -1, 1.0, 1.0, 0, 0); // mod
    smallPanel.addButton("Update", 1, -1, 1.0, 1.0, 0, 0); // mod

    p.addLineLabel("Mouse Action:", 0);
    CheckboxGroup mode_group = new CheckboxGroup();
    p.constraints.insets.bottom = 0;
    p.addCheckbox("Create Nodes", mode_group, emptyGraph, 1, -1, 1.0, 1.0, 0, 0);
    p.addCheckbox("Create Edges", mode_group, false, 0, -1, 1.0, 1.0, 0, 0);
    p.constraints.insets.top = p.constraints.insets.bottom = 0;
    p.addCheckbox("Select Nodes", mode_group, !emptyGraph, 1, -1, 1.0, 1.0, 0, 0);
    p.addCheckbox("Select Edges", mode_group, false, 0, -1, 1.0, 1.0, 0, 0);
    p.constraints.insets.top = p.constraints.insets.bottom = 0;
    p.addCheckbox("Select Nodes or Edges", mode_group, false, 0, -1, 1.0, 1.0, 0, 0);

    p1.add(p); // mod
    p = new LPanel(); // mod
    portScroller_ = new ViewportScroller(90, 90, 500.0, 500.0, 400.0, 400.0, 0.0, 0.0);
    portScroller_.setBackground(Color.lightGray);

    p.constraints.insets.bottom = 0;
    p.addLabel("Viewing Offset", 0, 0, 1.0, 1.0, 0, 0);
    p.constraints.insets.top = p.constraints.insets.bottom = 0;
    p.addComponent(portScroller_, 0, 0, 1.0, 1.0, 0, 0);
    p.constraints.insets.top = p.constraints.insets.bottom = 0;
    p.addButton("Center", 0, 0, 1.0, 1.0, 0, 0);

    p1.add(p); // mod
    p = new LPanel(); // mod

    scaleLabel_ = p.addLineLabel("Scale: 1", 0);

    LPanel sp = new LPanel();
    sp.spacing = 0;
    sp.constraints.insets.top = sp.constraints.insets.bottom = 0;
    // sp.addButton("Scale / 2", 1, -1, 1.0, 1.0, 0, 0);    // mod
    sp.addButton("Zoom In", 1, -1, 1.0, 1.0, 0, 0); // mod
    sp.addButton("Scale = 1", 1, -1, 1.0, 1.0, 0, 0);
    // sp.addButton("Scale * 2", 0, -1, 1.0, 1.0, 0, 0);     // mod
    sp.addButton("Zoom Out", 0, -1, 1.0, 1.0, 0, 0); // mod
    sp.finish();

    p.addComponent(sp, 0, 0, 1.0, 1.0, 0, 0);

    p1.add(p); // mod
    p = new LPanel(); // mod

    p.constraints.insets.top = 0;
    AngleControlPanel angc = new AngleControlPanel(180, 76);
    p.addComponent(angc, 0, 0, 1.0, 1.0, 1, 0);

    p1.add(p); // mod
    p = p1; // mod

    // super panel is there just to allow controls to be
    // fixed to top instead of centered
    // Panel controls_superpanel = new Panel();
    JPanel controls_superpanel = new JPanel();

    controls_superpanel.add("North", p);
    p.finish();
    // add("West", controls_superpanel);
    if (wantSmallPanel) {
      add("South", smallPanel); // mod
      controls_ = smallPanel; // mod
    } else {
      add("South", controls_superpanel); // mod
      controls_ = controls_superpanel;
    }
    if (!showControls_.getState()) {
      controls_.hide();
    } else {
      controls_.show();
    }

    graph_ = graph_in;

    // Node.defaults.setBoundingBox(20, 20, 20);
    // Node.defaults.setBoundingBox(10, 10, 10);
    Node.defaults.setBoundingBox(130, 90, 130);

    // the graph viewing canvas
    graphCanvas_ = new GraphCanvas(graph_, this);

    if (!emptyGraph) {
      graphCanvas_.setMouseMode(GraphCanvas.SELECT_NODES);
    }

    // the graph viewing panel (canvas and scrollbars)
    viewingPanel_ = new ScrolledPanel(graphCanvas_);
    add("Center", viewingPanel_);
    setBackground(Color.lightGray);
    validate();

    addKeyListener(
        new KeyAdapter() {
          public void keyReleased(KeyEvent e) {
            System.out.println("in GW.keyReleased");
            if (e.getKeyChar() == 's' || e.getKeyChar() == 'S') {
              System.out.println("Keyrelease " + e.getKeyChar() + ".");
              showControls_.setState(!showControls_.getState());
            }
            if (showControls_.getState()) controls_.show();
            else controls_.hide();
            validate();
          }
        });
  }