/** Creates new form frmMenuTeste */ public frmMenu() { // "pegue o conteúdo do painel" - adiciona o jDesktopPane ao JFrame (janela principal getContentPane().add(jdPane); // adiciona os menus à barra de menus (jmPrincipal) jmPrincipal.add(jmOperacao); jmPrincipal.add(jmFaturamento); jmPrincipal.add(jmBancoDeDados); // adiciona os itens aos respectivos menus jmOperacao.add(jmPedido); jmOperacao.add(jmReceberPedidosPendentes); jmOperacao.add(jmRealizarEntrega); jmFaturamento.add(jmEfetuarPagamento); jmBancoDeDados.add(jmCadCliente); jmBancoDeDados.add(jmCadProduto); // "ajusta" a barra de menu dentro da janela principal setJMenuBar(jmPrincipal); // adiciona actionlistener aos itens do menu para que os eventos sejam tratados jmPedido.addActionListener(this); jmReceberPedidosPendentes.addActionListener(this); jmRealizarEntrega.addActionListener(this); jmEfetuarPagamento.addActionListener(this); jmCadCliente.addActionListener(this); jmCadProduto.addActionListener(this); setSize(800, 600); setLocationRelativeTo(null); setResizable(false); setVisible(true); // initComponents(); }
private JMenuBar createMenu() { JMenuBar bar = new JMenuBar(); JMenu menuFile = new JMenu("File"); JMenuItem iReset = new JMenuItem("New"); iReset.addActionListener(this); menuFile.add(iReset); JMenuItem iLoad = new JMenuItem("Load"); iLoad.addActionListener(this); menuFile.add(iLoad); JMenuItem iSave = new JMenuItem("Save"); iSave.addActionListener(this); menuFile.add(iSave); JMenuItem iCompute = new JMenuItem("Compute"); iCompute.addActionListener(this); menuFile.add(iCompute); bar.add(menuFile); JMenu menuWeight = new JMenu("Weight"); JMenuItem iAddWeight = new JMenuItem("Add Weight"); iAddWeight.addActionListener(this); menuWeight.add(iAddWeight); JMenuItem iRemoveWeight = new JMenuItem("Remove Weight"); iRemoveWeight.addActionListener(this); menuWeight.add(iRemoveWeight); bar.add(menuWeight); return bar; }
public JMenuBar getPanelMenuBar() { if (panelMenuBar == null) { JMenuItem menuItem; ICFLibAnyObj container = getSwingContainer(); panelMenuBar = new JMenuBar(); menuAdd = new JMenu("Add"); actionAddMajorVersion = new ActionAddMajorVersion(); if (container instanceof ICFInternetRealProjectObj) { menuItem = new JMenuItem(actionAddMajorVersion); menuAdd.add(menuItem); } actionAddMinorVersion = new ActionAddMinorVersion(); if (container instanceof ICFInternetMajorVersionObj) { menuItem = new JMenuItem(actionAddMinorVersion); menuAdd.add(menuItem); } if (getSwingContainer() != null) { panelMenuBar.add(menuAdd); } menuSelected = new JMenu("Selected"); menuSelected.setEnabled(false); actionViewSelected = new ViewSelectedActionVersion(); menuItem = new JMenuItem(actionViewSelected); menuSelected.add(menuItem); actionEditSelected = new EditSelectedActionVersion(); menuItem = new JMenuItem(actionEditSelected); menuSelected.add(menuItem); actionDeleteSelected = new DeleteSelectedActionVersion(); menuItem = new JMenuItem(actionDeleteSelected); menuSelected.add(menuItem); panelMenuBar.add(menuSelected); } return (panelMenuBar); }
public static void main(String[] args) throws Exception { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { e.printStackTrace(); } UIManager.put("PopupMenuUI", "DropShadow.CustomPopupMenuUI"); JFrame frame = new JFrame(DropShadowDemo.class.getSimpleName()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JMenuBar mb = new JMenuBar(); frame.setJMenuBar(mb); JMenu menu = new JMenu("File"); mb.add(menu); menu.add(new JMenuItem("Open")); menu.add(new JMenuItem("Save")); menu.add(new JMenuItem("Close")); menu.add(new JMenuItem("Exit")); menu = new JMenu("Edit"); mb.add(menu); menu.add(new JMenuItem("Cut")); menu.add(new JMenuItem("Copy")); menu.add(new JMenuItem("Paste")); frame.getContentPane().setLayout(new BorderLayout()); frame.getContentPane().add("North", new JButton("Button")); frame.getContentPane().add("Center", new JLabel("a label")); frame.getContentPane().add("South", new JCheckBox("checkbox")); frame.pack(); frame.setSize(200, 150); frame.setLocationRelativeTo(null); frame.show(); }
private static void constructMenu() { final JFrame lFrame = (JFrame) viewModel.get("window.frame"); final JMenuBar lMenuBar = new JMenuBar(); lFrame.setJMenuBar(lMenuBar); viewModel.put("menu", lMenuBar); final JMenu lFileMenu = new JMenu("File"); lFileMenu.setMnemonic(KeyEvent.VK_F); viewModel.put("menu.file", lFileMenu); lMenuBar.add(lFileMenu); final JMenuItem lExitItem = new JMenuItem((Action) viewModel.get("action.exit")); viewModel.put("menu.file.exit", lExitItem); lFileMenu.add(lExitItem); final JMenuItem lHelpMenu = new JMenu("Help"); lHelpMenu.setMnemonic(KeyEvent.VK_H); viewModel.put("menu.help", lHelpMenu); lMenuBar.add(lHelpMenu); final JMenuItem lHelpTopicsItem = new JMenuItem((Action) viewModel.get("action.help")); viewModel.put("menu.help.topics", lHelpTopicsItem); lHelpMenu.add(lHelpTopicsItem); final JMenuItem lAboutItem = new JMenuItem((Action) viewModel.get("action.about")); viewModel.put("menu.help.about", lAboutItem); lHelpMenu.add(lAboutItem); }
/** Create menus to selct cross-section and spine */ private void initMenus() { JMenuBar menuBar = new JMenuBar(); JMenu crosssectionMenu = new JMenu("Cross-section"); menuBar.add(crosssectionMenu); myCrossSectionSelection = new ButtonGroup(); for (String s : myCrossSections.keySet()) { JMenuItem item = new JRadioButtonMenuItem(s); crosssectionMenu.add(item); myCrossSectionSelection.add(item); item.addItemListener(this); } myCrossSectionSelection.setSelected( myCrossSectionSelection.getElements().nextElement().getModel(), true); JMenu spineMenu = new JMenu("Spine"); menuBar.add(spineMenu); mySpineSelection = new ButtonGroup(); for (String s : mySpines.keySet()) { JMenuItem item = new JRadioButtonMenuItem(s); spineMenu.add(item); mySpineSelection.add(item); item.addItemListener(this); } mySpineSelection.setSelected(mySpineSelection.getElements().nextElement().getModel(), true); setJMenuBar(menuBar); }
public JMenuBar getPanelMenuBar() { if (panelMenuBar == null) { JMenuItem menuItem; ICFLibAnyObj container = getSwingContainer(); panelMenuBar = new JMenuBar(); menuAdd = new JMenu("Add"); actionAddSecGroupMember = new ActionAddSecGroupMember(); if (container instanceof ICFSecuritySecGroupObj) { menuItem = new JMenuItem(actionAddSecGroupMember); menuAdd.add(menuItem); } if (getSwingContainer() != null) { panelMenuBar.add(menuAdd); } menuSelected = new JMenu("Selected"); menuSelected.setEnabled(false); actionViewSelected = new ViewSelectedActionSecGroupMember(); menuItem = new JMenuItem(actionViewSelected); menuSelected.add(menuItem); actionEditSelected = new EditSelectedActionSecGroupMember(); menuItem = new JMenuItem(actionEditSelected); menuSelected.add(menuItem); actionDeleteSelected = new DeleteSelectedActionSecGroupMember(); menuItem = new JMenuItem(actionDeleteSelected); menuSelected.add(menuItem); panelMenuBar.add(menuSelected); } return (panelMenuBar); }
protected void addMenuActions(JMenuBar mb) { JMenu fileMenu = new JMenu("File"); addToMenu(actions.saveAction, fileMenu); addToMenu(actions.saveAsAction, fileMenu); fileMenu.addSeparator(); addToMenu(actions.importAction, fileMenu); addToMenu(actions.exportAction, fileMenu); fileMenu.addSeparator(); addToMenu(actions.exitAction, fileMenu); JMenu editMenu = new JMenu("Edit"); addToMenu(actions.undoAction, editMenu); addToMenu(actions.copyAction, editMenu); addToMenu(actions.pasteAction, editMenu); editMenu.addSeparator(); JMenu selectionMenu = new JMenu("Selection"); for (Action a : actions.layoutActions) addToMenu(a, selectionMenu); editMenu.add(selectionMenu); JMenu viewMenu = new JMenu("View"); JMenu zoomMenu = new JMenu("Zoom"); viewMenu.add(zoomMenu); for (Action a : actions.zoomActions) addToMenu(a, zoomMenu); JMenu helpMenu = new JMenu("Help"); mb.add(fileMenu); mb.add(editMenu); mb.add(viewMenu); mb.add(helpMenu); }
public JMenuBar getPanelMenuBar() { if (panelMenuBar == null) { JMenuItem menuItem; ICFLibAnyObj container = getSwingContainer(); panelMenuBar = new JMenuBar(); menuAdd = new JMenu("Add"); actionAddTextCol = new ActionAddTextCol(); if (container instanceof ICFDbTestTableObj) { menuItem = new JMenuItem(actionAddTextCol); menuAdd.add(menuItem); } actionAddTextType = new ActionAddTextType(); if (container instanceof ICFDbTestSchemaDefObj) { menuItem = new JMenuItem(actionAddTextType); menuAdd.add(menuItem); } if (getSwingContainer() != null) { panelMenuBar.add(menuAdd); } menuSelected = new JMenu("Selected"); menuSelected.setEnabled(false); actionViewSelected = new ViewSelectedActionTextDef(); menuItem = new JMenuItem(actionViewSelected); menuSelected.add(menuItem); actionEditSelected = new EditSelectedActionTextDef(); menuItem = new JMenuItem(actionEditSelected); menuSelected.add(menuItem); actionDeleteSelected = new DeleteSelectedActionTextDef(); menuItem = new JMenuItem(actionDeleteSelected); menuSelected.add(menuItem); panelMenuBar.add(menuSelected); } return (panelMenuBar); }
public DemoControls(Gradient demo) { super(demo.name); this.demo = demo; JMenuBar inMenuBar = new JMenuBar(); add(inMenuBar); JMenuBar outMenuBar = new JMenuBar(); add(outMenuBar); Font font = new Font("serif", Font.PLAIN, 10); imenu = (JMenu) inMenuBar.add(new JMenu("Inner Color")); imenu.setFont(font); imenu.setIcon(new ColoredSquare(demo.innerC)); omenu = (JMenu) outMenuBar.add(new JMenu("Outer Color")); omenu.setFont(font); omenu.setIcon(new ColoredSquare(demo.outerC)); for (int i = 0; i < colors.length; i++) { squares[i] = new ColoredSquare(colors[i]); innerMI[i] = imenu.add(new JMenuItem(colorName[i])); innerMI[i].setFont(font); innerMI[i].setIcon(squares[i]); innerMI[i].addActionListener(this); outerMI[i] = omenu.add(new JMenuItem(colorName[i])); outerMI[i].setFont(font); outerMI[i].setIcon(squares[i]); outerMI[i].addActionListener(this); } }
/** * Creates a Simple Neon Hex Frame Application * @throws IOException */ public Main() throws IOException { super("Hex"); setIconImage(Toolkit.getDefaultToolkit().getImage("images\\s1.png")); // Add in a menu JMenuBar menuBar = new JMenuBar(); JMenu gameMenu = new JMenu("Game"); gameMenu.setMnemonic('G'); newMenuItem = new JMenuItem("New Game"); newMenuItem.addActionListener(this); quitMenuItem = new JMenuItem("Exit"); quitMenuItem.addActionListener(this); gameMenu.add(newMenuItem); gameMenu.addSeparator(); gameMenu.add(quitMenuItem); menuBar.add(gameMenu); JMenu helpMenu = new JMenu("Help"); helpMenu.setMnemonic('H'); aboutMenuItem = new JMenuItem("About..."); aboutMenuItem.addActionListener(this); helpMenu.add(aboutMenuItem); menuBar.add(helpMenu); setJMenuBar(menuBar); // Set up the layout // Centre the frame in the middle (almost) of the screen setLayout(new BorderLayout()); tableArea = new Board(); add(tableArea, BorderLayout.CENTER); Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); setLocation((screen.width - Board.WIDTH) / 2, (screen.height - Board.HEIGHT) / 2 - 52); setResizable(false); }
/** * Method for setting up the menu bar and adding it to the main frame. * * @param frame the frame where to add the menu bar */ private void addMenuBar(JFrame frame) { JMenuBar menuBar = new JMenuBar(); frame.setJMenuBar(menuBar); // Menus file = new JMenu(lang.getText("ui.mainview.menu.file")); edit = new JMenu(lang.getText("ui.mainview.menu.edit")); help = new JMenu(lang.getText("ui.mainview.menu.help")); JMenuItem chooseLanguage = new JMenuItem(controller.getLanguageAction()); // Sub menus JMenuItem about = new JMenuItem(controller.getAboutAction()); JMenuItem addTodo = new JMenuItem(controller.getAddAction()); JMenuItem editTodo = new JMenuItem(controller.getEditAction()); JMenuItem deleteTodo = new JMenuItem(controller.getDeleteAction()); JMenuItem setTodo = new JMenuItem(controller.getDoneAction()); JMenuItem showGraph = new JMenuItem(controller.getShowGraphAction()); // Set up menu bar menuBar.add(file); menuBar.add(edit); menuBar.add(help); file.add(chooseLanguage); file.add(showGraph); help.add(about); edit.add(addTodo); edit.add(editTodo); edit.add(deleteTodo); edit.add(setTodo); }
private JMenuBar menubarra() { barra = new JMenuBar(); barra.add(menuEditar()); barra.add(menuSalir()); return barra; }
public JMenuBar makeMenuBar() { JMenuBar bar = new JMenuBar(); bar.add(makeFileMenu()); bar.add(makeToolsMenu()); bar.add(makeHelpMenu()); return bar; }
private void initMenuBar() { JMenuBar mb = new JMenuBar(); setJMenuBar(mb); JMenu file = new JMenu("Файл"); JMenuItem exit = file.add("Выход"); mb.add(file); JMenu about = new JMenu("About"); JMenuItem us = about.add("About us"); mb.add(about); exit.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { MainFrame.this.dispatchEvent( new WindowEvent(MainFrame.this, WindowEvent.WINDOW_CLOSING)); } }); us.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JOptionPane.showMessageDialog(MainFrame.this, "Автор: Завгаров Булат"); } }); }
private JMenuBar createMenu() { final JMenuBar bar = new JMenuBar(); { final JMenu menu = bar.add(new JMenu("File")); menu.setMnemonic('F'); menu.add(this.newMI("New", null, 'N', -1, this, "cmdNew")); menu.add(this.newMI("Open", null, 'O', KeyEvent.VK_O, this, "cmdOpen")); menu.addSeparator(); menu.add(this.newMI("Export Png", null, 'P', KeyEvent.VK_E, this, "cmdExportPng")); menu.addSeparator(); menu.add(this.newMI("Save", null, 'S', KeyEvent.VK_S, this, "cmdSave")); menu.add(this.newMI("Save As", null, 'A', -1, this, "cmdSaveAs")); menu.addSeparator(); menu.add(this.newMI("Exit", null, 'x', -1, this, "cmdExit")); } { final JMenu menu = bar.add(new JMenu("View")); menu.setMnemonic('V'); menu.add(this.newMI("Zoom", null, 'z', -1, this, "cmdZoom")); } { final JMenu menu = bar.add(new JMenu("Play")); menu.setMnemonic('P'); menu.setEnabled(false); // menu.add(newMI('a', -1, bStart.getAction())); // menu.add(newMI('P', -1, bPause.getAction())); // menu.add(newMI('o', -1, bStop.getAction())); } { final JMenu menu = bar.add(new JMenu("Help")); menu.setMnemonic('H'); menu.add(this.newMI("About", null, 'a', -1, this, "cmdAbout")); } return bar; }
private JMenuBar createMenuBar(RecordLedgerTable table) { final JMenuBar bar = new JMenuBar(); bar.add(createFileMenu()); bar.add(createEditMenu()); bar.add(createViewMenu(table)); return bar; }
/** Intialize me */ private void init() { myTables = new ArrayList(); tableTabbedPane = new JTabbedPane(); tableTabbedPane.setPreferredSize(new Dimension(450, 200)); JMenuBar menuBar = new JMenuBar(); JMenu fileMenu = new JMenu("File"); menuBar.add(fileMenu); fileMenu.add(GuiUtils.makeMenuItem("New Row", this, "addNewRow")); fileMenu.addSeparator(); fileMenu.add(GuiUtils.makeMenuItem("Open", this, "doOpen")); fileMenu.add(GuiUtils.makeMenuItem("Import", this, "doImport")); fileMenu.addSeparator(); fileMenu.add(GuiUtils.makeMenuItem("Export to File", this, "doSaveAs")); fileMenu.add(GuiUtils.makeMenuItem("Export to Plugin", this, "exportToPlugin")); fileMenu.add( GuiUtils.makeMenuItem("Export Selected to Plugin", this, "exportSelectedToPlugin")); fileMenu.addSeparator(); fileMenu.add(GuiUtils.makeMenuItem("Close", this, "doClose")); JMenu helpMenu = new JMenu("Help"); menuBar.add(helpMenu); helpMenu.add(GuiUtils.makeMenuItem("Parameter Defaults Help", this, "showHelp")); JComponent bottom = GuiUtils.wrap(GuiUtils.makeButton("Close", this, "doClose")); contents = GuiUtils.topCenterBottom(menuBar, GuiUtils.inset(tableTabbedPane, 2), bottom); setMenuBar(menuBar); loadResources(resources); }
public void setMenuBar(BeanTableFrame f) { final jmri.util.JmriJFrame finalF = f; // needed for anonymous ActionListener class JMenuBar menuBar = f.getJMenuBar(); JMenu pathMenu = new JMenu("Paths"); menuBar.add(pathMenu); JMenuItem item = new JMenuItem("Delete Paths..."); pathMenu.add(item); item.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { deletePaths(finalF); } }); JMenu speedMenu = new JMenu("Speeds"); item = new JMenuItem("Defaults..."); speedMenu.add(item); item.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { setDefaultSpeeds(finalF); } }); menuBar.add(speedMenu); }
/** * Gets the menubar. * * @return a menubar */ private JMenuBar getMenubar() { if (toolmap.size() == 0) { try { toolmap.load( Toolbox.class .getClassLoader() .getResourceAsStream("org/openXpertya/print/pdf/tools/plugins/tools.txt")); } catch (IOException e) { e.printStackTrace(); } } JMenuBar menubar = new JMenuBar(); JMenu file = new JMenu(FILE); file.setMnemonic(KeyEvent.VK_F); JMenuItem close = new JMenuItem(CLOSE); close.setMnemonic(KeyEvent.VK_C); close.addActionListener(this); file.add(close); JMenu tools = new JMenu(TOOLS); file.setMnemonic(KeyEvent.VK_T); JMenuItem item; String name; for (Iterator i = toolmap.keySet().iterator(); i.hasNext(); ) { name = (String) i.next(); item = new JMenuItem(name); item.addActionListener(this); tools.add(item); } menubar.add(file); menubar.add(tools); return menubar; }
public UserConsole(String path) { homePath = path; setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setPreferredSize(new Dimension(1862, 896)); setResizable(false); exit = new JMenuItem("Exit"); exit.setMnemonic('x'); exit.addActionListener(this); settings = new JMenuItem("Settings"); settings.setMnemonic('S'); settings.addActionListener(this); showXY = new JMenuItem("Show XY"); showXY.setMnemonic('Y'); showXY.addActionListener(this); quickRefresh = new JMenuItem("Quick Refresh"); quickRefresh.setMnemonic('R'); quickRefresh.addActionListener(this); switchingMode = new JMenuItem("Lean Switching Mode"); switchingMode.setMnemonic('L'); switchingMode.addActionListener(this); file = new JMenu("File"); file.setMnemonic('F'); file.add(exit); tools = new JMenu("Tools"); tools.setMnemonic('T'); tools.add(settings); tools.add(showXY); tools.add(quickRefresh); tools.add(switchingMode); menuBar = new JMenuBar(); menuBar.add(file); menuBar.add(tools); tabbedPane = new JTabbedPane(); thermoMap = new SwitchMapViewer(homePath, SwitchMapViewer.CLIMATE_STATUS); thermoSPMap = new SwitchMapViewer(homePath, SwitchMapViewer.CLIMATE_SET_POINT); lightMap = new SwitchMapViewer(homePath, SwitchMapViewer.LIGHTS_STATUS); lightSPMap = new SwitchMapViewer(homePath, SwitchMapViewer.LIGHTS_SET_POINT); // thermoMap.addMouseMotionListener(new MouseMotionListener()); statusBar = new StatusBar(); thermoMap.addStatusBar(statusBar); thermoSPMap.addStatusBar(statusBar); lightMap.addStatusBar(statusBar); lightSPMap.addStatusBar(statusBar); tabbedPane.add(thermoMap, "Temp Status"); tabbedPane.add(thermoSPMap, "Temp Set Point"); tabbedPane.add(lightMap, "Lights Status"); tabbedPane.add(lightSPMap, "Lights Set Point"); tabbedPane.add(switchLibView, "Switch Status"); tabbedPane.add(calendarLibView, "Calendar Status"); getContentPane().add(menuBar, BorderLayout.NORTH); getContentPane().add(tabbedPane, BorderLayout.CENTER); getContentPane().add(statusBar, BorderLayout.SOUTH); pack(); // 1845x805 setVisible(true); }
public static void main(String[] args) { try { // myFrame.add(newSubPanel); JTabbedPane tabbedPane = new JTabbedPane(); isSmall = true; // tabbedPane.add(new JButton("asd")); JMenuBar menuBar = new JMenuBar(); // menuBar.add(tabbedPane); menuBar.setBackground(Color.white); menuBar.setVisible(true); menuBar.add(new ResolutionButton()); menuBar.add(new NextPanelbutton(false)); menuBar.add(new NextPanelbutton(true)); // menuBar.setPreferredSize(new Dimension(1024, 20)); UpploaderView u = new UpploaderView(); tabbedPane.addTab("Channel", u); tabbedPane.addTab("Videos", newSubPanel); // menuBar.add(tabbedPane); // tabbedPane.setTabComponentAt(0,menuBar); // myFrame.add(u); // myFrame.add(tabbedPane); // myFrame.setLayout(new FlowLayout()); // Toolkit toolkit = Toolkit.getDefaultToolkit(); // System.out.println(toolkit.getScreenSize().width+"x"+toolkit.getScreenSize().height); myFrame.setSize(1024, 600); myFrame.setJMenuBar(menuBar); myFrame.addWindowListener(new WindowClose()); myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); myFrame.setVisible(true); Dimension panelDim = myFrame.getRootPane().getSize(); // myFrame.add(newSubPanel); for (int i = 0; i < 3; i++) { if (i == 0) { newSubs = new DoublePanelStack(new NewSubVideoPanel(panelDim)); myFrame.add(newSubs.getCurrentPanel()); myFrame.validate(); myFrame.repaint(); } if (StatCol.newsubsStartIndex < StatCol.MAXNEWSUBVIDEOS) newSubs.add(new NewSubVideoPanel(panelDim)); } // u.init(); // sub2 = new NewSubVideoPanel(newSubPanel.init(),panelDim); myFrame.validate(); // myFrame.pack(); } catch (AuthenticationException e) { e.printStackTrace(); } catch (MalformedURLException e) { e.printStackTrace(); } catch (ServiceException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }
/** Create menus */ private JMenuBar createMenus() { JMenuItem mi; // ***** create the menubar **** menuBar = new JMenuBar(); // ***** create File menu fileMenu = (JMenu) menuBar.add(new JMenu("File")); fileMenu.setMnemonic('F'); createMenuItem(fileMenu, "Print", 'P', "", new PrintAction(this)); createMenuItem(fileMenu, "Close", 'C', "", new CloseAction(this)); fileMenu.add(new JSeparator()); createMenuItem(fileMenu, "Exit", 'E', "", new ExitAction()); // ***** create laf switcher menu lafMenu = (JMenu) menuBar.add(new JMenu("Look & Feel")); lafMenu.setMnemonic('L'); mi = createLafMenuItem(lafMenu, "Java Look & Feel", 'J', "", metal); mi.setSelected(true); // this is the default l&f metalMenuItem = mi; createLafMenuItem(lafMenu, "Macintosh Look & Feel", 'M', "", mac); createLafMenuItem(lafMenu, "Motif Look & Feel", 'F', "", motif); createLafMenuItem(lafMenu, "Windows Look & Feel", 'W', "", windows); // ***** create themes menu themesMenu = (JMenu) menuBar.add(new JMenu("Themes")); themesMenu.setMnemonic('T'); mi = createThemesMenuItem(themesMenu, "Default", 'D', "", new DefaultMetalTheme()); mi.setSelected(true); // This is the default theme createThemesMenuItem(themesMenu, "Aqua", 'A', "", new AquaTheme()); createThemesMenuItem(themesMenu, "Charcoal", 'C', "", new CharcoalTheme()); createThemesMenuItem(themesMenu, "High Contrast", 'H', "", new ContrastTheme()); createThemesMenuItem(themesMenu, "Emerald", 'E', "", new EmeraldTheme()); createThemesMenuItem(themesMenu, "Ruby", 'R', "", new RubyTheme()); createThemesMenuItem(themesMenu, "Presentation", 'P', "", new DemoMetalTheme()); createThemesMenuItem(themesMenu, "Sandstone", 'S', "", new KhakiMetalTheme()); createThemesMenuItem(themesMenu, "Big High Contrast", 'I', "", new BigContrastMetalTheme()); createThemesMenuItem(themesMenu, "Blue", 'B', "", new BlueTheme()); createThemesMenuItem(themesMenu, "Cougaar", 'O', "", new CougaarTheme()); createThemesMenuItem( themesMenu, "Cougaar Presentation", 'O', "", new CougaarPresentationTheme()); return menuBar; }
/* * Frame Constructor */ public EvalGUI() { // map image Image img = null; try { img = ImageIO.read(new File("map2.png")); } catch (IOException e) { } img = img.getScaledInstance(300, 300, Image.SCALE_SMOOTH); JLabel small_img = new JLabel(new ImageIcon(img)); getContentPane().setLayout(new BorderLayout()); Right_Panel.add(Statistics_Panel, BorderLayout.CENTER); Statistics_Panel.add(dist_title); Statistics_Panel.add(totaldistance); Statistics_Panel.add(dist_curr_obj); Statistics_Panel.add(dist_charge); Statistics_Panel.add(clean_title); Statistics_Panel.add(space_covered); Statistics_Panel.add(room_covered); Statistics_Panel.add(charge_visits); Statistics_Panel.add(battery_title); Statistics_Panel.add(batt_remaining); Statistics_Panel.add(coverage_title); Statistics_Panel.add(nr_coverage_divisions); Statistics_Panel.add(vert_hor_div); Statistics_Panel.add(rob_coord); Statistics_Panel.add(time_elapsed); Statistics_Panel.add(time_completion); Right_Panel.add(small_img, BorderLayout.SOUTH); add(Right_Panel, BorderLayout.EAST); add(Map_Panel, BorderLayout.WEST); // menu items menubar.add(file); menubar.add(options); menubar.add(exit); file.add(newmap); options.add(measure); options.add(speed); exit.add(exit_); setJMenuBar(menubar); // frame operations setVisible(true); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(860, 650); setTitle("EvaluationGUI"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // pack(); }
private void buildMenu() { menuBar = new JMenuBar(); menuBar.add(fileMenu); menuBar.add(actionMenu); menuBar.add(viewMenu); menuBar.add(toolsMenu); menuBar.add(helpMenu); }
/** Standard constructor. */ public AimaDemoFrame() { setTitle("Artificial Intelligence a Modern Approach 3rd ed. Java Demos (AIMA3e-Java)"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setJMenuBar(menubar); menubar.add(appMenu); menubar.add(demoMenu); outStream = System.out; }
/** * This method initializes jJMenuBar * * @return JMenuBar */ private JMenuBar getJJMenuBar() { if (jJMenuBar == null) { jJMenuBar = new JMenuBar(); jJMenuBar.add(getGameMenu()); jJMenuBar.add(getJMenu()); } return jJMenuBar; }
/** Creates the menu bar */ private JMenuBar createMenuBar() { JMenuBar menuBar = new JMenuBar(); menuBar.add(createTabbedPanelMenu()); menuBar.add(createTitledTabMenu()); menuBar.add(createThemeMenu()); menuBar.add(createHoverMenu()); return menuBar; }
private void initMenu() { menuBar = new JMenuBar(); frmVisualizadord.setJMenuBar(menuBar); mnArchivo = new JMenu("Archivo"); menuBar.add(mnArchivo); mntmCargarArchivo = new JMenuItem("Cargar Archivo"); mntmCargarArchivo.setIcon(new ImageIcon(Visualizador3D.class.getResource("/icon/open.png"))); mntmCargarArchivo.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_MASK)); mntmCargarArchivo.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent arg0) { abrirArchivo(); } }); mnArchivo.add(mntmCargarArchivo); mntmGuardarComo = new JMenuItem("Guardar Como"); mntmGuardarComo.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent arg0) { guardarImagenComo(); } }); mntmGuardarComo.setIcon(new ImageIcon(Visualizador3D.class.getResource("/icon/save.png"))); mntmGuardarComo.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_MASK)); mnArchivo.add(mntmGuardarComo); separator = new JSeparator(); mnArchivo.add(separator); mntmSalir = new JMenuItem("Salir"); mntmSalir.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent arg0) { frmVisualizadord.dispose(); } }); mntmSalir.setIcon(new ImageIcon(Visualizador3D.class.getResource("/icon/close.png"))); mntmSalir.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F4, InputEvent.ALT_MASK)); mnArchivo.add(mntmSalir); mnAyuda = new JMenu("Ayuda"); menuBar.add(mnAyuda); mntmAcercaDe = new JMenuItem("Acerca De"); mntmAcercaDe.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent arg0) { AcercaDe acercaDe = new AcercaDe(); acercaDe.setVisible(true); } }); mntmAcercaDe.setIcon(new ImageIcon(Visualizador3D.class.getResource("/icon/about.png"))); mnAyuda.add(mntmAcercaDe); }
/** * This method initializes jJMenuBar * * @return javax.swing.JMenuBar */ private JMenuBar getJJMenuBar() { if (jJMenuBar == null) { jJMenuBar = new JMenuBar(); jJMenuBar.add(getFileMenu()); jJMenuBar.add(getEditMenu()); jJMenuBar.add(getHelpMenu()); } return jJMenuBar; }