List of usage examples for javax.swing JMenuBar add
public JMenu add(JMenu c)
From source file:Java2DExample.java
public Java2DExample() { super("Java 2D Image Processing Demo"); imagePanel = new ImagePanel(Java2DExample.class.getResource("yourImage.png")); JMenuBar menuBar = new JMenuBar(); setJMenuBar(menuBar);/* w w w .j ava 2 s.co m*/ filterMenu.setMnemonic('I'); JMenuItem originalMenuItem = new JMenuItem("Display Original"); originalMenuItem.setMnemonic('O'); originalMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent action) { imagePanel.displayOriginalImage(); } }); JMenuItem invertMenuItem = createMenuItem("Invert", 'I', invertFilter); JMenuItem sharpenMenuItem = createMenuItem("Sharpen", 'S', sharpenFilter); JMenuItem blurMenuItem = createMenuItem("Blur", 'B', blurFilter); JMenuItem changeColorsMenuItem = createMenuItem("Change Colors", 'C', colorFilter); filterMenu.add(originalMenuItem); filterMenu.add(invertMenuItem); filterMenu.add(sharpenMenuItem); filterMenu.add(blurMenuItem); filterMenu.add(changeColorsMenuItem); menuBar.add(filterMenu); getContentPane().add(imagePanel, BorderLayout.CENTER); }
From source file:ZipTest.java
public ZipTestFrame() { setTitle("ZipTest"); setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT); // add the menu and the Open and Exit menu items JMenuBar menuBar = new JMenuBar(); JMenu menu = new JMenu("File"); JMenuItem openItem = new JMenuItem("Open"); menu.add(openItem);/*from www. ja v a 2s . com*/ openItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { JFileChooser chooser = new JFileChooser(); chooser.setCurrentDirectory(new File(".")); int r = chooser.showOpenDialog(ZipTestFrame.this); if (r == JFileChooser.APPROVE_OPTION) { zipname = chooser.getSelectedFile().getPath(); fileCombo.removeAllItems(); scanZipFile(); } } }); JMenuItem exitItem = new JMenuItem("Exit"); menu.add(exitItem); exitItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { System.exit(0); } }); menuBar.add(menu); setJMenuBar(menuBar); // add the text area and combo box fileText = new JTextArea(); fileCombo = new JComboBox(); fileCombo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { loadZipFile((String) fileCombo.getSelectedItem()); } }); add(fileCombo, BorderLayout.SOUTH); add(new JScrollPane(fileText), BorderLayout.CENTER); }
From source file:com.simplexrepaginator.RepaginateFrame.java
protected JMenuBar createMenuBar() { JMenuBar mb = new JMenuBar(); JMenu m;/* w ww .j a v a 2 s . c om*/ m = new JMenu("File"); m.add(new AbstractAction("Select Input") { @Override public void actionPerformed(ActionEvent e) { input.doClick(); } }); m.add(new AbstractAction("Select Output") { @Override public void actionPerformed(ActionEvent e) { output.doClick(); } }); m.add(new UpdateCheckerAction()); m.add(new AbstractAction("Exit") { @Override public void actionPerformed(ActionEvent arg0) { dispose(); } }); mb.add(m); m = new JMenu("Help"); m.add(new AbstractAction("Website") { @Override public void actionPerformed(ActionEvent e) { try { URL url = new URL("http://www.simplexrepaginator.com/"); Desktop.getDesktop().browse(url.toURI()); } catch (IOException ioe) { } catch (URISyntaxException urise) { } } }); m.add(new AbstractAction("About") { @Override public void actionPerformed(ActionEvent e) { String license; try { license = IOUtils.toString(RepaginateFrame.class.getResource("LICENSE.txt")); } catch (IOException ioe) { license = "An error occured reading the license file:\n" + ioe; } JOptionPane.showMessageDialog(RepaginateFrame.this, license); } }); mb.add(m); return mb; }
From source file:mendeley2kindle.MainUIFrame.java
public MainUIFrame(Properties config, Mendeley2Kindle core) { super("Mendeley2Kindle"); setDefaultCloseOperation(EXIT_ON_CLOSE); this.core = core; core.addStateListener(new UISyncStateListener()); components = new ArrayList<JComponent>(); JMenuBar menuBar = new JMenuBar(); JMenu fileMenu = new JMenu("File"); JMenuItem openMenuItem = new JMenuItem("Open Mendeley database"); openMenuItem.addActionListener(new OpenMendeleyListener()); JMenuItem selectKindleMenuItem = new JMenuItem("Select Kindle device path"); selectKindleMenuItem.addActionListener(new SelectKindleListener()); JMenuItem exitMenuItem = new JMenuItem("Quit"); exitMenuItem.addActionListener(new QuitListener()); fileMenu.add(openMenuItem);/*w ww .j a v a 2 s . c om*/ fileMenu.add(selectKindleMenuItem); fileMenu.add(exitMenuItem); menuBar.add(fileMenu); JMenu helpMenu = new JMenu("Help"); JMenuItem aboutMenuItem = new JMenuItem("About"); aboutMenuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String text = "Mendeley2Kindle 0.3.2\n" + " (c) Copyright Yukinari Toyota, 2013. All rights reserved.\n" + " Contact: Yukinari Toyota <xxseyxx@gmail.com>\n" + " Site: http://sites.google.com/site/xxseyxx/\n" + "Some Icons by Yusuke Kamiyamane\n" + " Site: http://p.yusukekamiyamane.com/\n" + "sqlite-jdbc-3.7.2.jar is provided by xerial.org\n" + " under Apache License version 2.0 (http://www.apache.org/licenses/ )\n" + " Site: https://bitbucket.org/xerial/sqlite-jdbc\n"; JOptionPane.showMessageDialog(MainUIFrame.this, text); } }); helpMenu.add(aboutMenuItem); menuBar.add(helpMenu); setJMenuBar(menuBar); getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS)); getContentPane().add(new JLabel("Select Mendeley collections")); collectionsJList = new JList(); DragSelectionListener mil = new DragSelectionListener(); collectionsJList.addMouseMotionListener(mil); collectionsJList.addMouseListener(mil); collectionsJList.setCellRenderer(new MyCellRenderer()); // collectionsJList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); JScrollPane scroll = new JScrollPane(); scroll.setPreferredSize(new Dimension(200, 300)); scroll.getViewport().setView(collectionsJList); getContentPane().add(scroll); mainButton = new JButton("Open Mendeley database"); mainButton.addActionListener(new OpenMendeleyListener()); getContentPane().add(mainButton); components.add(collectionsJList); for (JComponent c : components) c.setEnabled(false); pack(); }
From source file:de.codesourcery.jasm16.ide.ui.MenuManager.java
protected JMenuBar createMenuBar() { final List<MenuEntry> copy; synchronized (entriesList) { copy = new ArrayList<MenuEntry>(entriesList); }/*from w w w . j a va2 s . c o m*/ // collect distinct parent paths final List<MenuPath> paths = new ArrayList<MenuPath>(); for (MenuEntry e : copy) { if (!e.isVisible()) { continue; } final MenuPath parentPath = e.getPath().getParentPath(); if (parentPath == null) { continue; } for (MenuPath p : parentPath.getAllPaths()) { if (!paths.contains(p)) { paths.add(p); } } } // sort paths ascending by length Collections.sort(paths, new Comparator<MenuPath>() { @Override public int compare(MenuPath o1, MenuPath o2) { final int len1 = o1.toString().length(); final int len2 = o2.toString().length(); if (len1 < len2) { return -1; } else if (len1 > len2) { return 1; } return 0; } }); /* * - a * | * +-- b * | * + c */ // create menu for each path final Map<MenuPath, JMenu> menuesByPath = new HashMap<MenuPath, JMenu>(); for (MenuPath path : paths) { final JMenu menu = new JMenu(path.getLastPathComponent()); menuesByPath.put(path, menu); JMenu parentMenu = menuesByPath.get(path.getParentPath()); if (parentMenu != null) { parentMenu.add(menu); } } // setup menu bar //Where the GUI is created: final JMenuBar menuBar = new JMenuBar(); final Set<MenuPath> topLevelMenues = new HashSet<MenuPath>(); for (final MenuEntry e : copy) { if (!e.isVisible()) { continue; } final MenuPath parentPath = e.getPath().getParentPath(); final JMenu menu = menuesByPath.get(parentPath); if (menu == null) { throw new RuntimeException("Internal error, failed to create menu for path: " + e.getPath()); } // register top-level menues if (parentPath.length() == 1) { if (!topLevelMenues.contains(parentPath)) { menuBar.add(menu); topLevelMenues.add(parentPath); } } final Action action; action = new AbstractAction(e.getLabel()) { @Override public void actionPerformed(ActionEvent event) { e.onClick(); } @Override public boolean isEnabled() { return e.isEnabled(); } }; final JMenuItem item = new JMenuItem(action) { @Override public boolean isEnabled() { return action.isEnabled(); } }; if (e.hasMnemonic()) { item.setMnemonic(e.getMnemonic()); } e.setMenuItem(item); menu.add(item); } return menuBar; }
From source file:com.github.lindenb.jvarkit.tools.bamviewgui.BamFileRef.java
BamFrame(List<BamFileRef> BamFileRefs) { super((JFrame) null, "Bam View (" + BamFileRefs.size() + " files)", ModalityType.APPLICATION_MODAL); this.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); this.BamFileRefs = BamFileRefs; addWindowListener(new WindowAdapter() { @Override//from w w w . j a v a 2 s . c o m public void windowOpened(WindowEvent e) { removeWindowListener(this); Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); d.width -= 150; d.height -= 150; for (BamFileRef vfr : BamFrame.this.BamFileRefs) { LOG.info("Reading " + vfr.bamFile); int w = (int) (d.width * 0.8); int h = (int) (d.height * 0.8); BamInternalFrame iFrame = new BamInternalFrame(vfr); iFrame.setBounds(Math.max((int) ((d.width - w) * Math.random()), 0), Math.max((int) ((d.height - h) * Math.random()), 0), w, h); desktopPane.add(iFrame); BamInternalFrames.add(iFrame); iFrame.setVisible(true); iFrame.jTable.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { JTable t = (JTable) e.getSource(); int row = t.getSelectedRow(); if (row == -1) return; BamTableModel tm = (BamTableModel) t.getModel(); showIgv(tm.getValueAt(row, 0), tm.getValueAt(row, 1)); } } }); } reloadFrameContent(); } }); addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { doMenuClose(); } }); JMenuBar bar = new JMenuBar(); setJMenuBar(bar); JMenu menu = new JMenu("File"); bar.add(menu); menu.add(new AbstractAction("Quit") { @Override public void actionPerformed(ActionEvent e) { doMenuClose(); } }); menu = new JMenu("Flags"); bar.add(menu); for (SamFlag flag : SamFlag.values()) { JCheckBox cbox = new JCheckBox("Require " + flag); requiredFlags.add(cbox); menu.add(cbox); } menu.add(new JSeparator()); for (SamFlag flag : SamFlag.values()) { JCheckBox cbox = new JCheckBox("Filter out " + flag); filteringFlags.add(cbox); menu.add(cbox); } JPanel contentPane = new JPanel(new BorderLayout(5, 5)); setContentPane(contentPane); this.desktopPane = new JDesktopPane(); contentPane.add(this.desktopPane, BorderLayout.CENTER); JPanel top = new JPanel(new FlowLayout(FlowLayout.LEADING)); contentPane.add(top, BorderLayout.NORTH); JLabel lbl = new JLabel("Max Rows:", JLabel.LEADING); JSpinner spinner = new JSpinner(this.numFetchModel = new SpinnerNumberModel(100, 1, 10000, 10)); lbl.setLabelFor(spinner); top.add(lbl); top.add(spinner); lbl = new JLabel("Timeout (secs):", JLabel.LEADING); spinner = new JSpinner(this.numSecondsModel = new SpinnerNumberModel(2, 1, 10000, 1)); lbl.setLabelFor(spinner); top.add(lbl); top.add(spinner); //lbl=new JLabel("JEXL:",JLabel.LEADING); /*jexlField=new JTextField(20); lbl.setLabelFor(jexlField); top.add(lbl); top.add(jexlField);*/ lbl = new JLabel("Region:", JLabel.LEADING); selectRgnField = new JTextField(20); lbl.setLabelFor(selectRgnField); AbstractAction action = new AbstractAction("Select") { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent a) { if ( /* (jexlField.getText().trim().isEmpty() || parseJex(jexlField.getText().trim())!=null) && */ (selectRgnField.getText().trim().isEmpty() || parseOne(selectRgnField.getText()) != null)) { reloadFrameContent(); } else { LOG.info("Bad input " + selectRgnField.getText()); } } }; selectRgnField.addActionListener(action); //jexlField.addActionListener(action); top.add(lbl); top.add(selectRgnField); top.add(new JButton(action)); }
From source file:livecanvas.mesheditor.MeshEditor.java
public JMenuBar createMenuBar() { JMenuBar menuBar = new JMenuBar(); JMenu menu, subMenu;// w ww . j a v a 2 s . c o m JMenuItem menuItem; menu = new JMenu("File"); menu.setMnemonic(KeyEvent.VK_F); menu.add(menuItem = Utils.createMenuItem("New", NEW, KeyEvent.VK_N, "ctrl N", this)); menu.add(menuItem = Utils.createMenuItem("Open...", OPEN, KeyEvent.VK_O, "ctrl O", this)); menu.add(menuItem = Utils.createMenuItem("Save", SAVE, KeyEvent.VK_S, "ctrl S", this)); menu.addSeparator(); menu.add(menuItem = Utils.createMenuItem("Exit", EXIT, KeyEvent.VK_X, "", this)); menuBar.add(menu); menu = new JMenu("Edit"); menu.setMnemonic(KeyEvent.VK_E); menu.add(menuItem = Utils.createMenuItem("Undo", UNDO, KeyEvent.VK_U, "ctrl Z", this)); menu.add(menuItem = Utils.createMenuItem("Redo", REDO, KeyEvent.VK_R, "ctrl Y", this)); menu.addSeparator(); menu.add(menuItem = Utils.createMenuItem("Cut", CUT, KeyEvent.VK_T, "ctrl X", this)); menu.add(menuItem = Utils.createMenuItem("Copy", COPY, KeyEvent.VK_C, "ctrl C", this)); menu.add(menuItem = Utils.createMenuItem("Paste", PASTE, KeyEvent.VK_P, "ctrl V", this)); menu.addSeparator(); menu.add(menuItem = Utils.createMenuItem("Select All", SELECT_ALL, KeyEvent.VK_A, "ctrl A", this)); menu.add(menuItem = Utils.createMenuItem("Invert Selection", INVERT_SELECTION, 0, "", this)); menu.addSeparator(); menu.add(menuItem = Utils.createMenuItem("Settings...", SETTINGS, KeyEvent.VK_S, "", this)); menuBar.add(menu); menu = new JMenu("Tools"); menu.setMnemonic(KeyEvent.VK_T); menu.add(menuItem = Utils.createMenuItem("Brush", TOOLS_BRUSH, KeyEvent.VK_B, "B", this)); menu.add(menuItem = Utils.createMenuItem("Pencil", TOOLS_PEN, KeyEvent.VK_N, "N", this)); menu.add(menuItem = Utils.createMenuItem("Magic Wand", TOOLS_MAGICWAND, KeyEvent.VK_W, "W", this)); menu.add(menuItem = Utils.createMenuItem("Set Control Points", TOOLS_SETCONTROLPOINTS, KeyEvent.VK_C, "C", this)); menu.add(menuItem = Utils.createMenuItem("Pointer", TOOLS_POINTER, KeyEvent.VK_P, "P", this)); menu.add(menuItem = Utils.createMenuItem("Pan / Zoom", TOOLS_PANZOOM, KeyEvent.VK_Z, "Z", this)); menuBar.add(menu); menu = new JMenu("Layers"); menu.setMnemonic(KeyEvent.VK_L); menu.add(menuItem = Utils.createMenuItem("Add Layer...", ADD_LAYER, KeyEvent.VK_A, "", this)); menu.add(menuItem = Utils.createMenuItem("Remove", REMOVE_LAYER, KeyEvent.VK_R, "", this)); menu.add(menuItem = Utils.createMenuItem("Duplicate", DUPLICATE_LAYER, KeyEvent.VK_C, "", this)); menu.addSeparator(); menu.add(menuItem = Utils.createMenuItem("Move Up", MOVEUP_LAYER, KeyEvent.VK_U, "", this)); menu.add(menuItem = Utils.createMenuItem("Move Down", MOVEDOWN_LAYER, KeyEvent.VK_D, "", this)); menu.addSeparator(); menu.add(menuItem = Utils.createMenuItem("Reparent Layer...", REPARENT_LAYER, KeyEvent.VK_R, "", this)); menu.addSeparator(); menu.add(menuItem = Utils.createMenuItem("Group Layers", GROUP_LAYERS, KeyEvent.VK_G, "", this)); menu.add(menuItem = Utils.createMenuItem("Ungroup Layer", UNGROUP_LAYER, KeyEvent.VK_N, "", this)); menu.addSeparator(); menu.add(menuItem = Utils.createMenuItem("Join Layers", JOIN_LAYERS, KeyEvent.VK_J, "", this)); menu.add(menuItem = Utils.createMenuItem("Intersect", INTERSECT_LAYERS, KeyEvent.VK_I, "", this)); menu.add(menuItem = Utils.createMenuItem("Subtract", SUBTRACT_LAYERS, KeyEvent.VK_S, "", this)); menu.addSeparator(); menu.add(menuItem = Utils.createMenuItem("Rename...", RENAME_LAYER, KeyEvent.VK_E, "", this)); menu.addSeparator(); subMenu = new JMenu("Background Reference"); subMenu.add(menuItem = Utils.createMenuItem("Set...", BGREF_SET, KeyEvent.VK_S, "", this)); subMenu.add(menuItem = Utils.createMenuItem("Remove", BGREF_REMOVE, KeyEvent.VK_R, "", this)); menu.add(subMenu); menuBar.add(menu); menu.addSeparator(); menu.add(menuItem = Utils.createMenuItem("Create Mesh Grid", CREATE_MESHGRID, KeyEvent.VK_M, "", this)); menu.addSeparator(); menu.add(menuItem = Utils.createCheckBoxMenuItem("See Through", SEE_THROUGH, KeyEvent.VK_T, "", this)); menuItem.setSelected(true); menu.add(menuItem = Utils.createCheckBoxMenuItem("Show Mesh", SHOW_MESH, KeyEvent.VK_M, "", this)); menuItem.setSelected(true); return menuBar; }
From source file:au.org.ala.delta.editor.DeltaEditor.java
private JMenuBar buildMenus() { JMenuBar menuBar = new JMenuBar(); // File menu. This on is kind of special, in that it gets rebuilt each // time a file is opened. _fileMenu = new JMenu(); _fileMenu.setName("mnuFile"); buildFileMenu(_fileMenu);//from ww w . jav a 2 s . c om menuBar.add(_fileMenu); // Edit Menu JMenu mnuEdit = buildEditMenu(); menuBar.add(mnuEdit); // Search Menu JMenu mnuSearch = buildSearchMenu(); menuBar.add(mnuSearch); // View Menu JMenu mnuView = buildViewMenu(); menuBar.add(mnuView); // Window menu _windowMenu = new JMenu(); _windowMenu.setName("mnuWindow"); buildWindowMenu(_windowMenu); menuBar.add(_windowMenu); JMenu mnuHelp = new JMenu(); mnuHelp.setName("mnuHelp"); JMenuItem mnuItHelpContents = new JMenuItem(); mnuItHelpContents.setName("mnuItHelpContents"); mnuHelp.add(mnuItHelpContents); mnuItHelpContents.addActionListener(_helpController.helpAction()); JMenuItem mnuItHelpOnSelection = new JMenuItem(IconHelper.createImageIcon("help_cursor.png")); mnuItHelpOnSelection.setName("mnuItHelpOnSelection"); mnuItHelpOnSelection.addActionListener(_helpController.helpOnSelectionAction()); mnuHelp.add(mnuItHelpOnSelection); javax.swing.Action openAboutAction = _actionMap.get("openAbout"); if (isMac()) { configureMacAboutBox(openAboutAction); } else { JMenuItem mnuItAbout = new JMenuItem(); mnuItAbout.setAction(openAboutAction); mnuHelp.addSeparator(); mnuHelp.add(mnuItAbout); } menuBar.add(mnuHelp); return menuBar; }
From source file:burlov.ultracipher.swing.SwingGuiApplication.java
private JMenuBar createMenuBar() { JMenuBar bar = new JMenuBar(); JMenu menu = null;//from ww w.j av a 2s . c o m /* * 'File' Menue */ menu = new JMenu("File"); menu.setMnemonic(KeyEvent.VK_F); bar.add(menu); JMenuItem item = new JMenuItem("Save database"); item.setAccelerator(KeyStroke.getKeyStroke("control S")); item.setMnemonic(KeyEvent.VK_S); item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { saveDatabase(); } }); menu.add(item); item = new JMenuItem("Download database"); item.setMnemonic(KeyEvent.VK_L); item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { downloadAndMergeData(); } }); menu.add(item); item = new JMenuItem("Edit sync account"); item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { editSyncAccount(); } }); menu.add(item); menu.add(new JSeparator()); JMenu submenu = new JMenu("Import"); menu.add(submenu); item = new JMenuItem("From CSV"); item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { importCSV(); } }); submenu.add(item); submenu = new JMenu("Export"); menu.add(submenu); item = new JMenuItem("As CSV"); item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { exportCSV(); } }); submenu.add(item); item = new JMenuItem("Change passphrase"); menu.add(item); item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { changePassword(); } }); /* * 'Edit' Menue */ menu = new JMenu("Edit"); menu.setMnemonic(KeyEvent.VK_E); bar.add(menu); item = menu.add(mainPanel.getNewEntryAction()); item.setMnemonic(KeyEvent.VK_N); item = menu.add(mainPanel.getDeleteEntryAction()); item.setMnemonic(KeyEvent.VK_D); menu.add(new JSeparator()); menu = new JMenu("Tools"); // item = new JMenuItem("Passwort generator"); // menu.add(item); // item.addActionListener(new ActionListener() { // // @Override // public void actionPerformed(ActionEvent e) { // passGenerator.setVisible(false); // passGenerator.setLocationRelativeTo(getMainFrame()); // passGenerator.setVisible(true); // } // }); item = new JMenuItem("Screen keyboard"); menu.add(item); item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { screenKeyboard.setLocationRelativeTo(getMainFrame()); screenKeyboard.setVisible(true); } }); item = new JMenuItem("File digester"); menu.add(item); item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { digester.setLocationRelativeTo(getMainFrame()); digester.setVisible(true); } }); bar.add(menu); /* * 'Help' Menue */ menu = new JMenu("Help"); menu.setMnemonic(KeyEvent.VK_H); bar.add(menu); item = new JMenuItem("Performance test"); menu.add(item); item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { measurePerformance(); } }); item = new JMenuItem("System info"); menu.add(item); item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { showSystemInfo(); } }); item = new JMenuItem("About"); menu.add(item); item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String text = "<html>Ultracipher 6.1<br>(C) Copyright 2015 Paul Burlov<br><br>" + "Encryption strength: 768Bit (6 x 128Bit keys)<br>Cipher cascade: AES/Twofish/Serpent/CAST6/SEED/Camellia" + "<br>Encryption mode: Two pass CBC" + "<br>Key derivation algorithm: SCrypt with N=2^14,P=8,R=1<br><br> " + "This product includes software developed by the<br>" + "<ul><li>Apache Software Foundation " + "<a href='http://www.apache.org'>http://www.apache.org</a>" + "<li>Legion of the Bouncy Castle <a href='http://bouncycastle.org/'>http://bouncycastle.org</a>" + "<li>Project SwingX" + "<li>Bytecode Pty Ltd." + "</ul></html>"; JOptionPane.showMessageDialog(getMainFrame(), text, "", JOptionPane.INFORMATION_MESSAGE, getAppIcon()); } }); bar.add(Box.createHorizontalGlue()); menu = new JMenu("Keyboard"); ButtonGroup group = new ButtonGroup(); JRadioButtonMenuItem radioitem = new JRadioButtonMenuItem("System"); radioitem.setSelected(true); group.add(radioitem); radioitem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { translator.resetMapping(); } }); menu.add(radioitem); radioitem = new JRadioButtonMenuItem("Futhark runes"); group.add(radioitem); radioitem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { translator.initForFuthark(); } }); menu.add(radioitem); radioitem = new JRadioButtonMenuItem("Anglo-Saxon runes"); group.add(radioitem); radioitem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { translator.initForAngloSaxon(); } }); menu.add(radioitem); bar.add(menu); // bar.add(Box.createHorizontalGlue()); // bar.add(new PassGeneratorPanel()); return bar; }
From source file:fll.scheduler.SchedulerUI.java
private JMenuBar createMenubar() { final JMenuBar menubar = new JMenuBar(); menubar.add(createFileMenu()); menubar.add(createDescriptionMenu()); menubar.add(createScheduleMenu());//from w w w. j a va2s . c om return menubar; }