Package java.awt

Examples of java.awt.MenuBar


      playerPanel.addMediaLocatorAndLoad(url);
    }
  }
 
  private final MenuBar getMenuBar() {
    MenuBar menuBar = new MenuBar();
   
    final Menu menuFile = new Menu();
    menuFile.setLabel("File");
    menuBar.add(menuFile);
   
    // File>Open File
    {
      final MenuItem menuItemOpenFile = new MenuItem("Open File...");
      menuItemOpenFile.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              playerPanel.onOpenFile();
            }
          }
        );
      menuFile.add(menuItemOpenFile);
    }

    // File>Open URL
    {
      final MenuItem menuItemOpenURL = new MenuItem("Open URL...");
      menuItemOpenURL.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              playerPanel.onOpenURL();
            }
          }
        );
      menuFile.add(menuItemOpenURL);
    }
   
    // File>Open RTP Session
    {
      final MenuItem menuItemReceiveRTP = new MenuItem("Open RTP Session...");
      menuItemReceiveRTP.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              playerPanel.onReceiveRTP();
            }
          }
        );
      menuFile.add(menuItemReceiveRTP);
    }
   
    // File>Capture
    {
      final MenuItem menuItemOpenCaptureDevice = new MenuItem("Capture...");
      menuItemOpenCaptureDevice.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              playerPanel.onOpenCaptureDevice();
            }
          }
        );
      menuFile.add(menuItemOpenCaptureDevice);
    }
   

    // separator
    menuFile.addSeparator();

    // TODO: export

    // File>Transmit RTP
    {
      final MenuItem menuItemTransmitRTP = new MenuItem("Transmit RTP...");
      menuItemTransmitRTP.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              playerPanel.onTransmitRTP();
            }
          }
        );
      menuFile.add(menuItemTransmitRTP);
    }

    // File>Transcode
    {
      final MenuItem menuItemTranscode = new MenuItem("Transcode...");
      menuItemTranscode.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              playerPanel.onTranscode();
            }
          }
        );
      menuFile.add(menuItemTranscode);
    }
   
    // separator
    menuFile.addSeparator();
   
    // File>Registry Editor
    {
      final MenuItem menuItemRegistryEditor = new MenuItem("Registry Editor...");
      menuItemRegistryEditor.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              onOpenRegistryEditor();
            }
          }
        );
      menuFile.add(menuItemRegistryEditor);
    }
   
    // File>Exit
    {
      final MenuItem menuItemExit = new MenuItem("Exit");
      menuItemExit.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              onExit();
            }
          }
        );
      menuFile.add(menuItemExit);
    }
   
   
    final Menu menuPlayer = new Menu();
    menuPlayer.setLabel("Player");
    menuBar.add(menuPlayer);
   
    // Player>Auto-play
    {
      final CheckboxMenuItem menuItemAutoPlay = new CheckboxMenuItem("Auto-play");
      menuItemAutoPlay.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e)
        {
          playerPanel.onAutoPlay(menuItemAutoPlay.getState());
        }
       
      });

      menuPlayer.add(menuItemAutoPlay);
      menuItemAutoPlay.setState(playerPanel.getPrefs().autoPlay);
    }
   
    // Player>Auto-loop
    {
      final CheckboxMenuItem menuItemAutoLoop = new CheckboxMenuItem("Auto-loop");
      menuItemAutoLoop.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e)
        {
          playerPanel.onAutoLoop(menuItemAutoLoop.getState());
        }
       
      });
      menuPlayer.add(menuItemAutoLoop);
      playerPanel.onAutoLoop(false);   // TODO: not working right yet.
      menuItemAutoLoop.setState(playerPanel.getPrefs().autoLoop);
      menuItemAutoLoop.setEnabled(false)// TODO: not working right yet.
     

    }

   
    final Menu menuHelp = new Menu();
    menuHelp.setLabel("Help");
    menuBar.add(menuHelp);
   
    // Help>About
    {
      final MenuItem menuItemHelpAbout = new MenuItem("About...");
      menuItemHelpAbout.addActionListener(
View Full Code Here


    }
      }
  };

  MenuItem item;
  MenuBar mb = new MenuBar();
  // File Menu
  Menu mnFile = new Menu("File");
  mnFile.add(item = new MenuItem("Open"));
  item.addActionListener(al);
  mnFile.add(item = new MenuItem("Exit"));
  item.addActionListener(al);

  // Options Menu 
  Menu mnOptions = new Menu("Options");
  cbAutoLoop = new CheckboxMenuItem("Auto replay");
  cbAutoLoop.setState(true);
  mnOptions.add(cbAutoLoop);
 
  mb.add(mnFile);
  mb.add(mnOptions);
  return mb;
    }     
View Full Code Here

    setJMenuBar(new JMenuBar());
   
    ((TreeViewJMenuBar) menubar).setUnderlyingMenuBar(getJMenuBar());
    } else {
      menubar = new TreeViewMenuBar();
      setMenuBar(new MenuBar());
     
      ((TreeViewMenuBar) menubar).setUnderlyingMenuBar(getMenuBar());
    }
    synchronized(menubar) {
      menubar.addMenu(TreeviewMenuBarI.programMenu);
View Full Code Here

        activityPanel.setSize(new Dimension(32, 32));
        activityPanel.setBorder(4);
       
        main.add(activityPanel, BorderLayout.EAST);

        menu = new MenuBar();
        menuLookup = new Hashtable();

        file = new Menu(Messages.getString("GUI.menu.file")); //$NON-NLS-1$
        // #ifdef DEBUG
        file.add(console);
View Full Code Here

        fMain.setIconImage(imgEmpty);
        fMain.addWindowListener(this);
        fMain.setSize(640, 480);
        fMain.add("Center", this);

        MenuBar  bar    = new MenuBar();
        String[] extras = {
            "Insert 10 rows only", "Insert 1000 rows only", "Insert all rows",
            "-", "Load Settings...", "Save Settings...", "-", "Exit"
        };
        Menu menu = new Menu("Options");

        addMenuItems(menu, extras);
        bar.add(menu);
        fMain.setMenuBar(bar);
        initGUI();

        Dimension d    = Toolkit.getDefaultToolkit().getScreenSize();
        Dimension size = fMain.getSize();
View Full Code Here

                2));

        fMain.setIconImage(imgEmpty);
        fMain.addWindowListener(this);

        MenuBar bar = new MenuBar();

        // used shortcuts: CERGTSIUDOLM
        String[] fitems = {
            "-Connect...", "--", "-Open Script...", "-Save Script...",
            "-Save Result...", "-Save Result csv...", "--", "-Exit"
        };

        addMenu(bar, "File", fitems);

        String[] vitems = {
            "RRefresh Tree", "--", "GResults in Grid", "TResults in Text",
            "--", "1Shrink Tree", "2Enlarge Tree", "3Shrink Command",
            "4Enlarge Command"
        };

        addMenu(bar, "View", vitems);

        String[] sitems = {
            "SSELECT", "IINSERT", "UUPDATE", "DDELETE", "--", "-CREATE TABLE",
            "-DROP TABLE", "-CREATE INDEX", "-DROP INDEX", "--", "-CHECKPOINT",
            "-SCRIPT", "-SET", "-SHUTDOWN", "--", "-Test Script"
        };

        addMenu(bar, "Command", sitems);

        Menu recent = new Menu("Recent");

        mRecent = new Menu("Recent");

        bar.add(mRecent);

        String[] soptions = {
            "-AutoCommit on", "-AutoCommit off", "OCommit", "LRollback", "--",
            "-Disable MaxRows", "-Set MaxRows to 100", "--", "-Logging on",
            "-Logging off", "--", "-Insert test data"
View Full Code Here

        getContentPane().setLayout(new BorderLayout());
        getContentPane().add("Center", close);

        // add a menu bar
        MenuBar mb = new MenuBar();
        Menu file = new Menu("File");
        file.setShortcut(new MenuShortcut(KeyEvent.VK_F, true));
        MenuItem tmp;
        file.add(tmp = new MenuItem("Connect"));
        tmp.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            pluginLoader.broadcast(new SocketRequest(host,
                                                     Integer.parseInt(port)));
          }
        });
        file.add(tmp = new MenuItem("Disconnect"));
        tmp.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            pluginLoader.broadcast(new SocketRequest());
          }
        });
        file.add(new MenuItem("-"));
        file.add(tmp = new MenuItem("Print"));
        tmp.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            if (pluginLoader.getComponents().get("Terminal") != null) {
              PrintJob printJob =
                      appletFrame.getContentPane().getToolkit()
                      .getPrintJob((JFrame) appletFrame, "JTA Terminal", null);
              ((Component) pluginLoader.getComponents().get("Terminal"))
                      .print(printJob.getGraphics());
              printJob.end();
            }
          }
        });
        file.add(new MenuItem("-"));
        file.add(tmp = new MenuItem("Exit"));
        tmp.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            ((JFrame) appletFrame).setVisible(false);
            pluginLoader.broadcast(new SocketRequest());
            close.setLabel(startText != null ? startText : "Connect");
          }
        });
        mb.add(file);

        Menu edit = new Menu("Edit");
        edit.setShortcut(new MenuShortcut(KeyEvent.VK_E, true));
        edit.add(tmp = new MenuItem("Copy"));
        tmp.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            if (debug > 2)
              System.err.println("Applet: copy: " + focussedPlugin);
            if (focussedPlugin instanceof VisualTransferPlugin)
              ((VisualTransferPlugin) focussedPlugin).copy(clipboard);
          }
        });
        edit.add(tmp = new MenuItem("Paste"));
        tmp.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            if (debug > 2)
              System.err.println("Applet: paste: " + focussedPlugin);
            if (focussedPlugin instanceof VisualTransferPlugin)
              ((VisualTransferPlugin) focussedPlugin).paste(clipboard);
          }
        });
        mb.add(edit);

        Map menuList = pluginLoader.getMenus();
        names = menuList.keySet().iterator();
        while (names.hasNext()) {
          String name = (String) names.next();
    Object o = menuList.get(name);
          if (o instanceof Menu) mb.add((Menu) o);
        }

        Menu help = new Menu("Help");
        help.setShortcut(new MenuShortcut(KeyEvent.VK_HELP, true));
        help.add(tmp = new MenuItem("General"));
        tmp.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            Help.show(appletFrame.getContentPane(), options.getProperty("Help.url"));
          }
        });
        mb.setHelpMenu(help);

        // only add the menubar if the property is true
        if ((new Boolean(options.getProperty("Applet.detach.menuBar"))
                .booleanValue()))
          ((JFrame) appletFrame).setMenuBar(mb);
View Full Code Here

        // TODO Auto-generated constructor stub
    }

    public Object createComponentInstance(Object parent, DomNode element)
    {
        MenuBar bar = new MenuBar();
        handleChildrenMenu(getClient(), bar, element);
        return bar;
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void processInput(BridgePeer peer, BridgeInputContext context, Map inputForm) throws InputException
    {
        MenuBar mb = (MenuBar) peer.getComponentObject();
        _logger.finest("Menubar has " + mb.getMenuCount() + " menus");
        for (int i = 0; i < mb.getMenuCount(); i++)
        {
            context.handleInput(mb.getMenu(i), inputForm);
        }
        Menu m = mb.getHelpMenu();
        if (m != null)
        {
            context.handleInput(m, inputForm);
        }
    }
View Full Code Here

          System.exit(0);
        }
      }
    );

    MenuBar mb = new MenuBar();
    createMenus(mb);
    frame.setMenuBar(mb);

    //---- first section
    Label suiteLabel= new Label("Test class name:");
View Full Code Here

TOP

Related Classes of java.awt.MenuBar

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.