List of usage examples for javax.swing JMenu setMnemonic
@BeanProperty(visualUpdate = true, description = "the keyboard character mnemonic") public void setMnemonic(int mnemonic)
From source file:org.tros.logo.swing.LogoMenuBar.java
/** * Set up the export menu./*from ww w . j a v a 2s .c o m*/ * * @return */ private JMenu setupExportMenu() { JMenu exportMenu = new JMenu(Localization.getLocalizedString("ExportMenu")); JMenuItem exportGif = new JMenuItem(Localization.getLocalizedString("ExportGIF")); JMenuItem exportPng = new JMenuItem(Localization.getLocalizedString("ExportPNG")); JMenuItem exportSvg = new JMenuItem(Localization.getLocalizedString("ExportSVG")); exportSvg.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { JFileChooser chooser = new JFileChooser(); chooser.setMultiSelectionEnabled(false); java.util.prefs.Preferences prefs = java.util.prefs.Preferences .userNodeForPackage(LogoMenuBar.class); chooser.setCurrentDirectory(new File(prefs.get("export-directory", "."))); chooser.setVisible(true); int result = chooser.showSaveDialog(parent); if (result == JFileChooser.APPROVE_OPTION) { String filename = chooser.getSelectedFile().getPath(); prefs.put("export-directory", chooser.getSelectedFile().getParent()); if (Drawable.class.isAssignableFrom(canvas.getClass())) { try (FileOutputStream fos = new FileOutputStream(new File(filename))) { generateSVG((Drawable) canvas, fos); fos.flush(); } catch (IOException ex) { org.tros.utils.logging.Logging.getLogFactory().getLogger(LogoMenuBar.class).warn(null, ex); } } } } }); exportGif.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { JFileChooser chooser = new JFileChooser(); chooser.setMultiSelectionEnabled(false); java.util.prefs.Preferences prefs = java.util.prefs.Preferences .userNodeForPackage(LogoMenuBar.class); chooser.setCurrentDirectory(new File(prefs.get("export-directory", "."))); chooser.setVisible(true); int result = chooser.showSaveDialog(parent); if (result == JFileChooser.APPROVE_OPTION) { final String filename = chooser.getSelectedFile().getPath(); prefs.put("export-directory", chooser.getSelectedFile().getParent()); Thread t = new Thread(new Runnable() { @Override public void run() { if (Drawable.class.isAssignableFrom(canvas.getClass()) && BufferedImageProvider.class.isAssignableFrom((canvas.getClass()))) { try { generateGIF(((Drawable) canvas).cloneDrawable(), (BufferedImageProvider) canvas, filename); } catch (SVGGraphics2DIOException ex) { Logger.getLogger(LogoMenuBar.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(LogoMenuBar.class.getName()).log(Level.SEVERE, null, ex); } } } }); t.setDaemon(true); t.start(); } } }); exportPng.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { JFileChooser chooser = new JFileChooser(); chooser.setMultiSelectionEnabled(false); java.util.prefs.Preferences prefs = java.util.prefs.Preferences .userNodeForPackage(LogoMenuBar.class); chooser.setCurrentDirectory(new File(prefs.get("export-directory", "."))); chooser.setVisible(true); int result = chooser.showSaveDialog(parent); if (result == JFileChooser.APPROVE_OPTION) { String filename = chooser.getSelectedFile().getPath(); prefs.put("export-directory", chooser.getSelectedFile().getParent()); // retrieve image if (BufferedImageProvider.class.isAssignableFrom(canvas.getClass())) { generatePNG((BufferedImageProvider) canvas, filename); } } } }); exportMenu.add(exportSvg); exportMenu.add(exportGif); exportMenu.add(exportPng); exportMenu.setMnemonic('X'); exportSvg.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.ALT_MASK)); exportGif.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_G, InputEvent.ALT_MASK)); exportPng.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_P, InputEvent.ALT_MASK)); return (exportMenu); }
From source file:org.tros.logo.swing.LogoMenuBar.java
/** * Set up the tools menu.//from ww w .ja va 2s . co m * * @return */ private JMenu setupToolsMenu() { JMenu toolsMenu = new JMenu(Localization.getLocalizedString("ToolsMenu")); toolsPenColorChooser = new JMenuItem(Localization.getLocalizedString("ToolsPenColorChooser")); toolsCanvasColorChooser = new JMenuItem(Localization.getLocalizedString("ToolsCanvasColorChooser")); toolsPenColorChooser.setMnemonic('P'); toolsCanvasColorChooser.setMnemonic('C'); toolsPenColorChooser.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { Color selected = JColorChooser.showDialog(parent, Localization.getLocalizedString("ColorChooser"), null); if (selected != null) { int red = selected.getRed(); int green = selected.getGreen(); int blue = selected.getBlue(); String hex = String.format("#%02x%02x%02x", red, green, blue); controller.insertCommand("pencolor" + " " + hex); } } }); toolsCanvasColorChooser.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { Color selected = JColorChooser.showDialog(parent, Localization.getLocalizedString("ColorChooser"), null); if (selected != null) { int red = selected.getRed(); int green = selected.getGreen(); int blue = selected.getBlue(); String hex = String.format("#%02x%02x%02x", red, green, blue); controller.insertCommand("canvascolor" + " " + hex); } } }); toolsMenu.add(toolsPenColorChooser); toolsMenu.add(toolsCanvasColorChooser); toolsMenu.setMnemonic('T'); return (toolsMenu); }
From source file:pl.otros.logview.gui.LogViewMainFrame.java
private void initMenu() { JMenuBar menuBar = getJMenuBar(); if (menuBar == null) { menuBar = new JMenuBar(); setJMenuBar(menuBar);/*from w ww . java 2 s .co m*/ } menuBar.removeAll(); JMenu fileMenu = new JMenu("File"); fileMenu.setMnemonic(KeyEvent.VK_F); JLabel labelOpenLog = new JLabel("Open log", Icons.FOLDER_OPEN, SwingConstants.LEFT); Font menuGroupFont = labelOpenLog.getFont().deriveFont(13f).deriveFont(Font.BOLD); labelOpenLog.setFont(menuGroupFont); fileMenu.add(labelOpenLog); JMenuItem openAutoDetectLog = new JMenuItem("Open log with autodetect type"); openAutoDetectLog.addActionListener(new ImportLogWithAutoDetectedImporterActionListener(otrosApplication)); openAutoDetectLog.setMnemonic(KeyEvent.VK_O); openAutoDetectLog.setIcon(Icons.WIZARD); fileMenu.add(openAutoDetectLog); JMenuItem tailAutoDetectLog = new JMenuItem("Tail log with autodetect type"); tailAutoDetectLog.addActionListener(new TailLogWithAutoDetectActionListener(otrosApplication)); tailAutoDetectLog.setMnemonic(KeyEvent.VK_T); tailAutoDetectLog.setIcon(Icons.ARROW_REPEAT); fileMenu.add(tailAutoDetectLog); fileMenu.add(new TailMultipleFilesIntoOneView(otrosApplication)); fileMenu.add(new ConnectToSocketHubAppenderAction(otrosApplication)); fileMenu.add(new JSeparator()); JLabel labelLogInvestigation = new JLabel("Log investigation", SwingConstants.LEFT); labelLogInvestigation.setFont(menuGroupFont); fileMenu.add(labelLogInvestigation); fileMenu.add(new OpenLogInvestigationAction(otrosApplication)); JMenuItem saveLogsInvest = new JMenuItem(new SaveLogInvestigationAction(otrosApplication)); enableDisableComponetsForTabs.addComponet(saveLogsInvest); fileMenu.add(saveLogsInvest); fileMenu.add(new JSeparator()); LogImporter[] importers = new LogImporter[0]; importers = logImportersContainer.getElements().toArray(importers); for (LogImporter logImporter : importers) { JMenuItem openLog = new JMenuItem("Open " + logImporter.getName() + " log"); openLog.addActionListener(new ImportLogWithGivenImporterActionListener(otrosApplication, logImporter)); if (logImporter.getKeyStrokeAccelelator() != null) { openLog.setAccelerator(KeyStroke.getKeyStroke(logImporter.getKeyStrokeAccelelator())); } if (logImporter.getMnemonic() > 0) { openLog.setMnemonic(logImporter.getMnemonic()); } Icon icon = logImporter.getIcon(); if (icon != null) { openLog.setIcon(icon); } fileMenu.add(openLog); } fileMenu.add(new JSeparator()); JLabel labelTailLog = new JLabel("Tail log [from begging of file]", Icons.ARROW_REPEAT, SwingConstants.LEFT); labelTailLog.setFont(menuGroupFont); fileMenu.add(labelTailLog); for (LogImporter logImporter : importers) { JMenuItem openLog = new JMenuItem("Tail " + logImporter.getName() + " log"); openLog.addActionListener(new TailLogActionListener(otrosApplication, logImporter)); if (logImporter.getKeyStrokeAccelelator() != null) { openLog.setAccelerator(KeyStroke.getKeyStroke(logImporter.getKeyStrokeAccelelator())); } if (logImporter.getMnemonic() > 0) { openLog.setMnemonic(logImporter.getMnemonic()); } Icon icon = logImporter.getIcon(); if (icon != null) { openLog.setIcon(icon); } fileMenu.add(openLog); } JMenuItem exitMenuItem = new JMenuItem("Exit", 'e'); exitMenuItem.setIcon(Icons.TURN_OFF); exitMenuItem.setAccelerator(KeyStroke.getKeyStroke("control F4")); exitAction = new ExitAction(this); exitMenuItem.addActionListener(exitAction); fileMenu.add(new JSeparator()); fileMenu.add(exitMenuItem); JMenu toolsMenu = new JMenu("Tools"); toolsMenu.setMnemonic(KeyEvent.VK_T); JMenuItem closeAll = new JMenuItem(new CloseAllTabsAction(otrosApplication)); enableDisableComponetsForTabs.addComponet(closeAll); ArrayList<SocketLogReader> logReaders = new ArrayList<SocketLogReader>(); toolsMenu.add(new JMenuItem(new StartSocketListener(otrosApplication, logReaders))); toolsMenu.add(new JMenuItem(new StopAllSocketListeners(otrosApplication, logReaders))); toolsMenu.add(new ShowMarkersEditor(otrosApplication)); toolsMenu.add(new ShowLog4jPatternParserEditor(otrosApplication)); toolsMenu.add(new ShowMessageColorizerEditor(otrosApplication)); toolsMenu.add(new ShowLoadedPlugins(otrosApplication)); toolsMenu.add(new ShowOlvLogs(otrosApplication)); toolsMenu.add(new OpenPreferencesAction(otrosApplication)); toolsMenu.add(closeAll); JMenu pluginsMenu = new JMenu("Plugins"); otrosApplication.setPluginsMenu(pluginsMenu); JMenu helpMenu = new JMenu("Help"); JMenuItem about = new JMenuItem("About"); AboutAction action = new AboutAction(otrosApplication); action.putValue(Action.NAME, "About"); about.setAction(action); helpMenu.add(about); helpMenu.add(new GoToDonatePageAction(otrosApplication)); JMenuItem checkForNewVersion = new JMenuItem(new CheckForNewVersionAction(otrosApplication)); helpMenu.add(checkForNewVersion); helpMenu.add(new GettingStartedAction(otrosApplication)); menuBar.add(fileMenu); menuBar.add(toolsMenu); menuBar.add(pluginsMenu); menuBar.add(helpMenu); }
From source file:sc.fiji.kappa.gui.KappaMenuBar.java
/** * Creates a menu-bar and adds menu items to it *//*from ww w.java 2s . c om*/ public KappaMenuBar(Context context, KappaFrame frame) { context.inject(this); this.frame = frame; // File chooser for curve data FileNameExtensionFilter kappaFilter = new FileNameExtensionFilter("Kappa Files", "kapp"); kappaLoad = new JFileChooser(); kappaLoad.setFileFilter(kappaFilter); kappaLoad.setDialogTitle("Load Existing Curve Data"); kappaSave = new JFileChooser(); kappaSave.setFileFilter(kappaFilter); kappaSave.setDialogTitle("Save Curve Data"); // Declares the file menu JMenu fileMenu = new JMenu("File"); fileMenu.setMnemonic('F'); /* * // Menu Items for file operations // Creates a new file chooser. Same native * image support as ImageJ since ImageJ // libraries are used. kappaOpen = new * JFileChooser(); FileNameExtensionFilter filter = new * FileNameExtensionFilter("Image Files", "tif", "tiff", "jpeg", "jpg", "bmp", * "fits", "pgm", "ppm", "pbm", "gif", "png", "dic", "dcm", "dicom", "lsm", * "avi"); kappaOpen.setFileFilter(filter); * * JMenuItem openMenu = new JMenuItem("Open Image File"); * openMenu.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, DEFAULT_MASK)); * openMenu.addActionListener(e -> { int returnVal = * kappaOpen.showOpenDialog(this.frame); if (returnVal == * JFileChooser.APPROVE_OPTION) { openImageFile(kappaOpen.getSelectedFile()); } * }); fileMenu.add(openMenu); */ JMenuItem openActiveMenu = new JMenuItem("Open Active Image"); openActiveMenu.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, DEFAULT_MASK)); openActiveMenu.addActionListener(e -> { openActiveImage(context); }); fileMenu.add(openActiveMenu); fileMenu.addSeparator(); JMenuItem importROIsAsCurvesMenu = new JMenuItem("Import ROIs as curves"); importROIsAsCurvesMenu.addActionListener(e -> { importROIsAsCurves(context); }); fileMenu.add(importROIsAsCurvesMenu); fileMenu.addSeparator(); JMenuItem loadMenu = new JMenuItem("Load Curve Data"); loadMenu.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_L, DEFAULT_MASK)); loadMenu.addActionListener(e -> { // Handle open button action. int returnVal = kappaLoad.showOpenDialog(this.frame); if (returnVal == JFileChooser.APPROVE_OPTION) { file = kappaLoad.getSelectedFile(); loadCurveFile(file); } }); fileMenu.add(loadMenu); JMenuItem saveMenu = new JMenuItem("Save Curve Data"); saveMenu.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, DEFAULT_MASK)); saveMenu.addActionListener(e -> { String dirPath = frame.getImageStack().getOriginalFileInfo().directory; if (dirPath != null) { String kappaPath = FilenameUtils .removeExtension(frame.getImageStack().getOriginalFileInfo().fileName); kappaPath += ".kapp"; File fullPath = new File(dirPath, kappaPath); kappaSave.setSelectedFile(fullPath); } // Handles save button action. int returnVal = kappaSave.showSaveDialog(this.frame); if (returnVal == JFileChooser.APPROVE_OPTION) { file = kappaSave.getSelectedFile(); // Appends a .kapp if (!file.getPath().toLowerCase().endsWith(".kapp")) { file = new File(file.getPath() + ".kapp"); } saveCurveFile(file); } }); fileMenu.add(saveMenu); this.add(fileMenu); // Menu Items for all the tools JMenu toolMenu = new JMenu("Tools"); for (int i = 0; i < ToolPanel.NO_TOOLS; i++) { toolMenuItems[i] = new JMenuItem(ToolPanel.TOOL_MENU_NAMES[i]); toolMenuItems[i].setEnabled(false); toolMenuItems[i].setAccelerator(KeyStroke.getKeyStroke(ToolPanel.TOOL_MNEMONICS[i], 0)); final int j = i; toolMenuItems[i].addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { frame.getToolPanel().setSelected(j, true); frame.getScrollPane().setCursor(ToolPanel.TOOL_CURSORS[j]); } }); toolMenu.add(toolMenuItems[i]); } // We also add a menu item for deleting Bezier Curves via the Backspace key. setDelete(new JMenuItem("Delete Curves")); getDelete().addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { frame.deleteCurve(); } }); getDelete().setEnabled(false); getDelete().setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0)); toolMenu.addSeparator(); toolMenu.add(getDelete()); setEnter(new JMenuItem("Enter Curve")); getEnter().addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { frame.enterCurve(); } }); getEnter().setEnabled(false); getEnter().setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0)); toolMenu.add(getEnter()); fit = new JMenuItem("Fit Curve"); fit.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { frame.fitCurves(); } }); fit.setEnabled(false); fit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F, 0)); toolMenu.add(fit); toolMenu.addSeparator(); // TODO remove this later // JMenuItem runTestScript = new JMenuItem ("Run Testing Script"); // runTestScript.addActionListener (new ActionListener(){ // public void actionPerformed (ActionEvent event){ // try{frame.testingScript();} // catch(IOException e){System.out.println("Script Error");} // }}); // runTestScript.setAccelerator (KeyStroke.getKeyStroke(KeyEvent.VK_S, 0)); // toolMenu.add(runTestScript); JCheckBoxMenuItem toggleCtrlPtAdjustment = new JCheckBoxMenuItem("Enable Control Point Adjustment"); toggleCtrlPtAdjustment.setState(frame.isEnableCtrlPtAdjustment()); toggleCtrlPtAdjustment.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { frame.setEnableCtrlPtAdjustment(!frame.isEnableCtrlPtAdjustment()); ; } }); toggleCtrlPtAdjustment.setEnabled(true); toolMenu.add(toggleCtrlPtAdjustment); this.add(toolMenu); // Navigation Menu // TODO FIX action listeners to these. JMenu navigateMenu = new JMenu("Navigate"); prevFrame = new JMenuItem("Previous Frame"); nextFrame = new JMenuItem("Next Frame"); prevKeyframe = new JMenuItem("Previous Keyframe"); nextKeyframe = new JMenuItem("Next Keyframe"); prevFrame.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, ActionEvent.ALT_MASK)); nextFrame.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, ActionEvent.ALT_MASK)); prevKeyframe.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, DEFAULT_MASK)); nextKeyframe.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, DEFAULT_MASK)); prevFrame.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { frame.getControlPanel().getCurrentLayerSlider() .setValue(Math.max(frame.getControlPanel().getCurrentLayerSlider().getValue() - 1, frame.getControlPanel().getCurrentLayerSlider().getMinimum())); } }); nextFrame.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { frame.getControlPanel().getCurrentLayerSlider() .setValue(Math.min(frame.getControlPanel().getCurrentLayerSlider().getValue() + 1, frame.getControlPanel().getCurrentLayerSlider().getMaximum())); } }); prevKeyframe.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { } }); nextKeyframe.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { } }); prevFrame.setEnabled(false); nextFrame.setEnabled(false); prevKeyframe.setEnabled(false); nextKeyframe.setEnabled(false); navigateMenu.add(prevFrame); navigateMenu.add(nextFrame); navigateMenu.add(prevKeyframe); navigateMenu.add(nextKeyframe); this.add(navigateMenu); // Image options. JMenu imageMenu = new JMenu("Image"); // Brightness and Contrast tool. Taken from ImageJ. adjustBrightnessContrast = new JMenuItem("Adjust Brightness/Contrast"); adjustBrightnessContrast.setEnabled(false); adjustBrightnessContrast.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ContrastAdjuster c = new ContrastAdjuster(frame); c.run("Brightness/Contrast...[C]"); } }); imageMenu.add(adjustBrightnessContrast); this.add(imageMenu); // Zoom-In and Zoom-Out Commands JMenu viewMenu = new JMenu("View"); zoomIn = new JMenuItem("Zoom In"); zoomOut = new JMenuItem("Zoom Out"); zoomIn.addActionListener(new ZoomInListener(frame.getControlPanel())); zoomOut.addActionListener(new ZoomOutListener(frame.getControlPanel())); zoomIn.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_EQUALS, DEFAULT_MASK)); zoomOut.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_MINUS, DEFAULT_MASK)); zoomIn.setEnabled(false); zoomOut.setEnabled(false); // Menu Item for showing bounding boxes setBoundingBoxMenu(new JCheckBoxMenuItem("Show Bounding Boxes")); getBoundingBoxMenu().setState(false); getBoundingBoxMenu().addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent a) { frame.drawImageOverlay(); } }); getBoundingBoxMenu().setEnabled(false); // Menu Item for choosing the x-axis values for the curvature and intensity // display // For instance, you can display x vs. curvature, or current arc length vs // curvature, or the point index vs curvature // The default is the point index. distributionDisplay = DEFAULT_DISTRIBUTION_DISPLAY; JMenu xAxisSubmenu = new JMenu("Curve Distribution X-Axis:"); ButtonGroup xAxisGroup = new ButtonGroup(); JMenuItem xValue = new JCheckBoxMenuItem("X-Coordinate"); JMenuItem curveLength = new JCheckBoxMenuItem("Arc Length"); JMenuItem pointIndex = new JCheckBoxMenuItem("Point Index"); xAxisGroup.add(xValue); xAxisGroup.add(curveLength); xAxisGroup.add(pointIndex); xAxisSubmenu.add(xValue); xAxisSubmenu.add(curveLength); xAxisSubmenu.add(pointIndex); xValue.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent a) { distributionDisplay = 0; frame.getInfoPanel().updateHistograms(); } }); curveLength.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent a) { distributionDisplay = 1; frame.getInfoPanel().updateHistograms(); } }); pointIndex.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent a) { distributionDisplay = 2; frame.getInfoPanel().updateHistograms(); } }); if (DEFAULT_DISTRIBUTION_DISPLAY == 0) { xValue.setSelected(true); } else if (DEFAULT_DISTRIBUTION_DISPLAY == 1) { curveLength.setSelected(true); } else { pointIndex.setSelected(true); } // Menu Item for scaling curve strokes when zooming in or out setScaleCurvesMenu(new JCheckBoxMenuItem("Scale Curve Strokes")); getScaleCurvesMenu().setState(true); getScaleCurvesMenu().addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent a) { frame.drawImageOverlay(); } }); getScaleCurvesMenu().setEnabled(false); // Menu Item for image antialiasing setAntialiasingMenu(new JCheckBoxMenuItem("Enable Antialiasing")); getAntialiasingMenu().setState(false); getAntialiasingMenu().addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent a) { frame.setScaledImage(frame.getControlPanel().getScaleSlider().getValue() / 100.0); frame.drawImageOverlay(); } }); getAntialiasingMenu().setEnabled(false); // Menu Item for displaying tangent and normal curves. setTangentMenu(new JCheckBoxMenuItem("Show Tangent and Normal Vectors")); getTangentMenu().setState(false); getTangentMenu().addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent a) { frame.drawImageOverlay(); } }); getTangentMenu().setEnabled(false); viewMenu.add(zoomIn); viewMenu.add(zoomOut); viewMenu.addSeparator(); viewMenu.add(xAxisSubmenu); viewMenu.addSeparator(); viewMenu.add(getScaleCurvesMenu()); viewMenu.add(getTangentMenu()); viewMenu.add(getBoundingBoxMenu()); viewMenu.add(getAntialiasingMenu()); this.add(viewMenu); // Sets a "Help" menu list JMenu helpMenu = new JMenu("Help"); helpMenu.setMnemonic('H'); // Adds an "About" option to the menu list JMenuItem aboutMenuItem = new JMenuItem("About...", 'A'); aboutMenuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { JOptionPane.showMessageDialog(frame, "Developed by the Brouhard lab, 2016-2017.", KappaFrame.APPLICATION_NAME, JOptionPane.INFORMATION_MESSAGE); } }); // Adds a link to the User Manual JMenuItem userManualLink = new JMenuItem("User Manual"); userManualLink.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { try { if (Desktop.isDesktopSupported()) { Desktop.getDesktop().browse(new URI( "https://dl.dropboxusercontent.com/u/157117/KappaFrame%20User%20Manual.pdf")); } } catch (Exception e) { System.out.println("Incorrect URL Syntax"); } ; } }); // Adds all newly created menu items to the "Help" list helpMenu.add(userManualLink); helpMenu.add(aboutMenuItem); this.add(helpMenu); }
From source file:us.daveread.basicquery.BasicQuery.java
/** * File menu setup// w ww . j a v a2 s .com * * @return The file menu */ private JMenu fileMenu() { JMenu menu; // File Menu menu = new JMenu(Resources.getString("mnuFileLabel")); menu.setMnemonic(Resources.getChar("mnuFileAccel")); menu.getAccessibleContext().setAccessibleDescription(Resources.getString("mnuFileDesc")); // File | Open SQL File fileOpenSQL = new JMenuItem(Resources.getString("mnuFileOpenLabel")); fileOpenSQL.setAccelerator( KeyStroke.getKeyStroke(Resources.getChar("mnuFileOpenAccel"), ActionEvent.ALT_MASK)); fileOpenSQL.setMnemonic(Resources.getChar("mnuFileOpenAccel")); fileOpenSQL.getAccessibleContext().setAccessibleDescription(Resources.getString("mnuFileOpenDesc")); fileOpenSQL.addActionListener(this); fileOpenSQL.setEnabled(true); menu.add(fileOpenSQL); menu.addSeparator(); // File | Log Stats fileLogStats = new JCheckBoxMenuItem(Resources.getString("mnuFileLogStatsLabel")); fileLogStats.setAccelerator( KeyStroke.getKeyStroke(Resources.getChar("mnuFileLogStatsAccel"), ActionEvent.ALT_MASK)); fileLogStats.setMnemonic(Resources.getChar("mnuFileLogStatsAccel")); fileLogStats.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuFileLogStatsAccel", DBSTATS_NAME)); fileLogStats.setEnabled(true); fileLogStats.setSelected(false); menu.add(fileLogStats); // File | Log Results fileLogResults = new JCheckBoxMenuItem(Resources.getString("mnuFileLogResultsLabel")); fileLogResults.setAccelerator( KeyStroke.getKeyStroke(Resources.getChar("mnuFileLogResultsAccel"), ActionEvent.ALT_MASK)); fileLogResults.setMnemonic(Resources.getString("mnuFileLogResultsAccel").charAt(0)); fileLogResults.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuFileLogResultsDesc", DBRESULTS_NAME)); fileLogResults.setEnabled(true); fileLogResults.setSelected(false); menu.add(fileLogResults); menu.addSeparator(); // File | Export Results As CSV fileSaveAsCSV = new JMenuItem(Resources.getString("mnuFileExportCSVLabel")); fileSaveAsCSV.setAccelerator( KeyStroke.getKeyStroke(Resources.getChar("mnuFileExportCSVAccel"), ActionEvent.ALT_MASK)); fileSaveAsCSV.setMnemonic(Resources.getChar("mnuFileExportCSVAccel")); fileSaveAsCSV.getAccessibleContext().setAccessibleDescription(Resources.getString("mnuFileExportCSVDesc")); fileSaveAsCSV.addActionListener(this); fileSaveAsCSV.setEnabled(false); menu.add(fileSaveAsCSV); // File | Export Results As Triples fileSaveAsTriples = new JMenuItem(Resources.getString("mnuFileExportTriplesLabel")); fileSaveAsTriples.setAccelerator( KeyStroke.getKeyStroke(Resources.getChar("mnuFileExportTriplesAccel"), ActionEvent.ALT_MASK)); fileSaveAsTriples.setMnemonic(Resources.getChar("mnuFileExportTriplesAccel")); fileSaveAsTriples.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuFileExportTriplesDesc")); fileSaveAsTriples.addActionListener(new ExportResultsAsTriplesListener()); fileSaveAsTriples.setEnabled(false); menu.add(fileSaveAsTriples); // File | Save BLOBs fileSaveBLOBs = new JMenuItem(Resources.getString("mnuFileSaveBLOBLabel")); fileSaveBLOBs.setAccelerator( KeyStroke.getKeyStroke(Resources.getChar("mnuFileSaveBLOBAccel"), ActionEvent.ALT_MASK)); fileSaveBLOBs.setMnemonic(Resources.getChar("mnuFileSaveBLOBAccel")); fileSaveBLOBs.getAccessibleContext().setAccessibleDescription(Resources.getString("mnuFileSaveBLOBDesc")); fileSaveBLOBs.addActionListener(this); fileSaveBLOBs.setEnabled(false); menu.add(fileSaveBLOBs); menu.addSeparator(); // File | Raw Export fileExportsRaw = new JCheckBoxMenuItem(Resources.getString("mnuFileRawExportLabel")); fileExportsRaw.setMnemonic(Resources.getChar("mnuFileRawExportAccel")); fileExportsRaw.getAccessibleContext().setAccessibleDescription(Resources.getString("mnuFileRawExportDesc")); fileExportsRaw.setEnabled(true); fileExportsRaw.setSelected(false); menu.add(fileExportsRaw); // File | No CR Added to Export fileNoCRAddedToExportRows = new JCheckBoxMenuItem(Resources.getString("mnuFileNoCRLabel")); fileNoCRAddedToExportRows.setMnemonic(Resources.getChar("mnuFileNoCRAccel")); fileNoCRAddedToExportRows.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuFileNoCRDesc")); fileNoCRAddedToExportRows.setEnabled(true); fileNoCRAddedToExportRows.setSelected(false); menu.add(fileNoCRAddedToExportRows); menu.addSeparator(); fileExit = new JMenuItem(Resources.getString("mnuFileExitLabel")); fileExit.setAccelerator( KeyStroke.getKeyStroke(Resources.getChar("mnuFileExitAccel"), ActionEvent.ALT_MASK)); fileExit.setMnemonic(Resources.getChar("mnuFileExitAccel")); fileExit.getAccessibleContext().setAccessibleDescription(Resources.getString("mnuFileExitDesc")); fileExit.addActionListener(this); fileExit.setEnabled(true); menu.add(fileExit); return menu; }
From source file:us.daveread.basicquery.BasicQuery.java
/** * Edit menu setup/*from w w w . j av a 2 s .c o m*/ * * @return The edit menu */ private JMenu editMenu() { JMenu menu; // Edit Menu menu = new JMenu(Resources.getString("mnuEditLabel")); menu.setMnemonic(Resources.getChar("mnuEditAccel")); menu.getAccessibleContext().setAccessibleDescription(Resources.getString("mnuEditDesc")); // Edit | Copy editCopy = new JMenuItem(Resources.getString("mnuEditCopyLabel")); editCopy.setAccelerator( KeyStroke.getKeyStroke(Resources.getChar("mnuEditCopyAccel"), ActionEvent.ALT_MASK)); editCopy.setMnemonic(Resources.getChar("mnuEditCopyAccel")); editCopy.getAccessibleContext().setAccessibleDescription(Resources.getString("mnuEditCopyDesc")); editCopy.addActionListener(this); editCopy.setEnabled(true); menu.add(editCopy); // Edit | Select All editSelectAll = new JMenuItem(Resources.getString("mnuEditSelectAllLabel")); editSelectAll.setAccelerator( KeyStroke.getKeyStroke(Resources.getChar("mnuEditSelectAllAccel"), ActionEvent.ALT_MASK)); editSelectAll.setMnemonic(Resources.getChar("mnuEditSelectAllAccel")); editSelectAll.getAccessibleContext().setAccessibleDescription(Resources.getString("mnuEditSelectAllDesc")); editSelectAll.addActionListener(this); editSelectAll.setEnabled(true); menu.add(editSelectAll); menu.addSeparator(); // Edit | Sort by Selected Columns editSort = new JMenuItem(Resources.getString("mnuEditSortLabel")); editSort.setMnemonic(Resources.getChar("mnuEditSortAccel")); editSort.getAccessibleContext().setAccessibleDescription(Resources.getString("mnuEditSortDesc")); editSort.addActionListener(this); editSort.setEnabled(true); menu.add(editSort); return menu; }
From source file:us.daveread.basicquery.BasicQuery.java
/** * Query menu set/*ww w . ja va 2 s .com*/ * * @return The query menu */ private JMenu queryMenu() { JMenu menu; // Query Menu menu = new JMenu(Resources.getString("mnuQueryLabel")); menu.setMnemonic(Resources.getChar("mnuQueryAccel")); menu.getAccessibleContext().setAccessibleDescription(Resources.getString("mnuQueryDesc")); // Query | Select Statement queryMakeVerboseSelect = new JMenuItem(Resources.getString("mnuQuerySelectLabel")); queryMakeVerboseSelect.setAccelerator( KeyStroke.getKeyStroke(Resources.getChar("mnuQuerySelectAccel"), ActionEvent.ALT_MASK)); queryMakeVerboseSelect.setMnemonic(Resources.getChar("mnuQuerySelectAccel")); queryMakeVerboseSelect.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuQuerySelectDesc")); queryMakeVerboseSelect.addActionListener(this); queryMakeVerboseSelect.setEnabled(true); menu.add(queryMakeVerboseSelect); // Query | Insert Statement queryMakeInsert = new JMenuItem(Resources.getString("mnuQueryInsertLabel")); queryMakeInsert.setAccelerator( KeyStroke.getKeyStroke(Resources.getChar("mnuQueryInsertAccel"), ActionEvent.ALT_MASK)); queryMakeInsert.setMnemonic(Resources.getChar("mnuQueryInsertAccel")); queryMakeInsert.getAccessibleContext().setAccessibleDescription(Resources.getString("mnuQueryInsertDesc")); queryMakeInsert.addActionListener(this); queryMakeInsert.setEnabled(true); menu.add(queryMakeInsert); // Query | Update Statement queryMakeUpdate = new JMenuItem(Resources.getString("mnuQueryUpdateLabel")); queryMakeUpdate.setAccelerator( KeyStroke.getKeyStroke(Resources.getChar("mnuQueryUpdateAccel"), ActionEvent.ALT_MASK)); queryMakeUpdate.setMnemonic(Resources.getChar("mnuQueryUpdateAccel")); queryMakeUpdate.getAccessibleContext().setAccessibleDescription(Resources.getString("mnuQueryUpdateDesc")); queryMakeUpdate.addActionListener(this); queryMakeUpdate.setEnabled(true); menu.add(queryMakeUpdate); menu.addSeparator(); // Query | Select * querySelectStar = new JMenuItem(Resources.getString("mnuQuerySelectStarLabel")); querySelectStar.setAccelerator( KeyStroke.getKeyStroke(Resources.getChar("mnuQuerySelectStarAccel"), ActionEvent.ALT_MASK)); querySelectStar.setMnemonic(Resources.getChar("mnuQuerySelectStarAccel")); querySelectStar.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuQuerySelectStarDesc")); querySelectStar.addActionListener(this); querySelectStar.setEnabled(true); menu.add(querySelectStar); // Query | Describe Select * queryDescribeStar = new JMenuItem(Resources.getString("mnuQueryDescSelectStarLabel")); queryDescribeStar.setAccelerator( KeyStroke.getKeyStroke(Resources.getChar("mnuQueryDescSelectStarAccel"), ActionEvent.ALT_MASK)); queryDescribeStar.setMnemonic(Resources.getChar("mnuQueryDescSelectStarAccel")); queryDescribeStar.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuQueryDescSelectStarDesc")); queryDescribeStar.addActionListener(this); queryDescribeStar.setEnabled(true); menu.add(queryDescribeStar); menu.addSeparator(); // Query | Reorder Queries querySetOrder = new JMenuItem(Resources.getString("mnuQueryReorderLabel")); querySetOrder.setMnemonic(Resources.getChar("mnuQueryReorderAccel")); querySetOrder.getAccessibleContext().setAccessibleDescription(Resources.getString("mnuQueryReorderDesc")); querySetOrder.addActionListener(this); querySetOrder.setEnabled(true); menu.add(querySetOrder); menu.addSeparator(); // Query | Run All queryRunAll = new JMenuItem(Resources.getString("mnuQueryRunAllLabel")); queryRunAll.setAccelerator( KeyStroke.getKeyStroke(Resources.getChar("mnuQueryRunAllAccel"), ActionEvent.ALT_MASK)); queryRunAll.setMnemonic(Resources.getChar("mnuQueryRunAllAccel")); queryRunAll.getAccessibleContext().setAccessibleDescription(Resources.getString("mnuQueryRunAllDesc")); queryRunAll.addActionListener(this); queryRunAll.setEnabled(true); menu.add(queryRunAll); return menu; }
From source file:us.daveread.basicquery.BasicQuery.java
/** * Language selection menu//from w w w. j a v a 2 s .c o m * * @return The language selection menu */ private JMenu languageMenu() { JMenu subMenu; ButtonGroup buttonGroup; // Setup | Language subMenu = new JMenu(Resources.getString("mnuSetupLanguageLabel")); subMenu.setMnemonic(Resources.getChar("mnuSetupLanguageAccel")); subMenu.getAccessibleContext().setAccessibleDescription(Resources.getString("mnuSetupLanguageDesc")); // Setup | Language | System Default if (System.getProperty(PROP_SYSTEM_DEFAULTLANGUAGE) != null) { if (System.getProperty(PROP_SYSTEM_DEFAULTCOUNTRY) != null) { configLanguageDefault = new JRadioButtonMenuItem(Resources.getString("mnuSetupLanguageDefaultLabel") + " (" + System.getProperty(PROP_SYSTEM_DEFAULTLANGUAGE) + "_" + System.getProperty(PROP_SYSTEM_DEFAULTCOUNTRY) + ")"); } else { configLanguageDefault = new JRadioButtonMenuItem(Resources.getString("mnuSetupLanguageDefaultLabel") + " (" + System.getProperty(PROP_SYSTEM_DEFAULTLANGUAGE) + ")"); } } else { configLanguageDefault = new JRadioButtonMenuItem(Resources.getString("mnuSetupLanguageDefaultLabel")); } configLanguageDefault.setMnemonic(Resources.getChar("mnuSetupLanguageDefaultAccel")); configLanguageDefault.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuSetupLanguageDefaultDesc")); configLanguageDefault.addActionListener(this); subMenu.add(configLanguageDefault); // Setup | Language | Deutsche (German) configLanguageGerman = new JRadioButtonMenuItem(Resources.getString("mnuSetupLanguageGermanLabel")); configLanguageGerman.setMnemonic(Resources.getChar("mnuSetupLanguageGermanAccel")); configLanguageGerman.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuSetupLanguageGermanDesc")); configLanguageGerman.addActionListener(this); subMenu.add(configLanguageGerman); // Setup | Language | English configLanguageEnglish = new JRadioButtonMenuItem(Resources.getString("mnuSetupLanguageEnglishLabel")); configLanguageEnglish.setMnemonic(Resources.getChar("mnuSetupLanguageEnglishAccel")); configLanguageEnglish.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuSetupLanguageEnglishDesc")); configLanguageEnglish.addActionListener(this); subMenu.add(configLanguageEnglish); // Setup | Language | Espanola (Spanish) configLanguageSpanish = new JRadioButtonMenuItem(Resources.getString("mnuSetupLanguageSpanishLabel")); configLanguageSpanish.setMnemonic(Resources.getChar("mnuSetupLanguageSpanishAccel")); configLanguageSpanish.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuSetupLanguageSpanishDesc")); configLanguageSpanish.addActionListener(this); subMenu.add(configLanguageSpanish); // Setup | Language | Francaise (French) configLanguageFrench = new JRadioButtonMenuItem(Resources.getString("mnuSetupLanguageFrenchLabel")); configLanguageFrench.setMnemonic(Resources.getChar("mnuSetupLanguageFrenchAccel")); configLanguageFrench.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuSetupLanguageFrenchDesc")); configLanguageFrench.addActionListener(this); subMenu.add(configLanguageFrench); // Setup | Language | Italiana (Italian) configLanguageItalian = new JRadioButtonMenuItem(Resources.getString("mnuSetupLanguageItalianLabel")); configLanguageItalian.setMnemonic(Resources.getChar("mnuSetupLanguageItalianAccel")); configLanguageItalian.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuSetupLanguageItalianDesc")); configLanguageItalian.addActionListener(this); subMenu.add(configLanguageItalian); // Setup | Language | Portugues (Portuguese) configLanguagePortuguese = new JRadioButtonMenuItem(Resources.getString("mnuSetupLanguagePortugueseLabel")); configLanguagePortuguese.setMnemonic(Resources.getChar("mnuSetupLanguagePortugueseAccel")); configLanguagePortuguese.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuSetupLanguagePortugueseDesc")); configLanguagePortuguese.addActionListener(this); subMenu.add(configLanguagePortuguese); buttonGroup = new ButtonGroup(); buttonGroup.add(configLanguageDefault); buttonGroup.add(configLanguageEnglish); buttonGroup.add(configLanguageFrench); buttonGroup.add(configLanguageGerman); buttonGroup.add(configLanguageItalian); buttonGroup.add(configLanguagePortuguese); buttonGroup.add(configLanguageSpanish); return subMenu; }
From source file:us.daveread.basicquery.BasicQuery.java
/** * Configuration menu setup/*from www . j a v a 2 s. c o m*/ * * @return The configuration menu */ private JMenu configurationMenu() { JMenu menu; JMenu subMenu; ButtonGroup buttonGroup; // Configuration Menu menu = new JMenu(Resources.getString("mnuSetupLabel")); menu.setMnemonic(Resources.getChar("mnuSetupAccel")); menu.getAccessibleContext().setAccessibleDescription(Resources.getString("mnuSetupDesc")); menu.add(languageMenu()); // Setup | Font configFont = new JMenuItem(Resources.getString("mnuConfigFontLabel")); configFont.setMnemonic(Resources.getChar("mnuConfigFontAccel")); configFont.getAccessibleContext().setAccessibleDescription(Resources.getString("mnuConfigFontDesc")); configFont.addActionListener(this); configFont.setEnabled(true); menu.add(configFont); // Setup | Display DB Server Info subMenu = new JMenu(Resources.getString("mnuSetupDBServerLabel")); subMenu.setMnemonic(Resources.getChar("mnuSetupDBServerAccel")); subMenu.getAccessibleContext().setAccessibleDescription(Resources.getString("mnuSetupDBServerDesc")); menu.add(subMenu); // Configuration | Display DB Server Info | None configDisplayDBServerInfoNone = new JRadioButtonMenuItem(Resources.getString("mnuSetupDBServerNoneLabel")); configDisplayDBServerInfoNone.setMnemonic(Resources.getChar("mnuSetupDBServerNoneAccel")); configDisplayDBServerInfoNone.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuSetupDBServerNoneDesc")); subMenu.add(configDisplayDBServerInfoNone); // Configuration | Display DB Server Info | Brief configDisplayDBServerInfoShort = new JRadioButtonMenuItem( Resources.getString("mnuSetupDBServerBriefLabel")); configDisplayDBServerInfoShort.setMnemonic(Resources.getChar("mnuSetupDBServerBriefAccel")); configDisplayDBServerInfoShort.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuSetupDBServerBriefDesc")); subMenu.add(configDisplayDBServerInfoShort); // Configuration | Display DB Server Info | Long configDisplayDBServerInfoLong = new JRadioButtonMenuItem(Resources.getString("mnuSetupDBServerLongLabel")); configDisplayDBServerInfoLong.setMnemonic(Resources.getChar("mnuSetupDBServerLongAccel")); configDisplayDBServerInfoLong.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuSetupDBServerLongDesc")); subMenu.add(configDisplayDBServerInfoLong); buttonGroup = new ButtonGroup(); buttonGroup.add(configDisplayDBServerInfoNone); buttonGroup.add(configDisplayDBServerInfoLong); buttonGroup.add(configDisplayDBServerInfoShort); // Default is short display of DB server info configDisplayDBServerInfoShort.setSelected(true); // Setup | Table Row Coloring subMenu = new JMenu(Resources.getString("mnuSetupRowColorLabel")); subMenu.setMnemonic(Resources.getChar("mnuSetupRowColorAccel")); subMenu.getAccessibleContext().setAccessibleDescription(Resources.getString("mnuSetupRowColorDesc")); menu.add(subMenu); // Setup | Table Row Coloring | None configTableColoringNone = new JRadioButtonMenuItem(Resources.getString("mnuSetupRowColorNoneLabel")); configTableColoringNone.setMnemonic(Resources.getChar("mnuSetupRowColorNoneAccel")); configTableColoringNone.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuSetupRowColorNoneDesc")); configTableColoringNone.addActionListener(this); subMenu.add(configTableColoringNone); // Setup | Table Row Coloring | Green Bar configTableColoringGreenBar = new JRadioButtonMenuItem( Resources.getString("mnuSetupRowColorGreenBarLabel")); configTableColoringGreenBar.setMnemonic(Resources.getChar("mnuSetupRowColorGreenBarAccel")); configTableColoringGreenBar.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuSetupRowColorGreenBarDesc")); configTableColoringGreenBar.addActionListener(this); subMenu.add(configTableColoringGreenBar); // Setup | Table Row Coloring | Yellow Bar configTableColoringYellowBar = new JRadioButtonMenuItem( Resources.getString("mnuSetupRowColorYellowBarLabel")); configTableColoringYellowBar.setMnemonic(Resources.getChar("mnuSetupRowColorYellowBarAccel")); configTableColoringYellowBar.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuSetupRowColorYellowBarDesc")); configTableColoringYellowBar.addActionListener(this); subMenu.add(configTableColoringYellowBar); subMenu.addSeparator(); // Setup | Table Row Coloring | User Defined configTableColoringUserDefined = new JRadioButtonMenuItem( Resources.getString("mnuSetupRowColorUserDefLabel")); configTableColoringUserDefined.setMnemonic(Resources.getChar("mnuSetupRowColorUserDefAccel")); configTableColoringUserDefined.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuSetupRowColorUserDefDesc")); configTableColoringUserDefined.addActionListener(this); subMenu.add(configTableColoringUserDefined); buttonGroup = new ButtonGroup(); buttonGroup.add(configTableColoringNone); buttonGroup.add(configTableColoringGreenBar); buttonGroup.add(configTableColoringYellowBar); buttonGroup.add(configTableColoringUserDefined); // Default is no special coloring of data rows configTableColoringNone.setSelected(true); menu.addSeparator(); // Configuration | Associate SQL and Connect URL configHistoryAssocSQLAndConnect = new JCheckBoxMenuItem(Resources.getString("mnuSetupAssocSQLURLLabel")); configHistoryAssocSQLAndConnect.setMnemonic(Resources.getChar("mnuSetupAssocSQLURLAccel")); configHistoryAssocSQLAndConnect.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuSetupAssocSQLURLDesc")); configHistoryAssocSQLAndConnect.setEnabled(true); menu.add(configHistoryAssocSQLAndConnect); // Configuration | Parse SQL at Semi-Colons configParseSemicolons = new JCheckBoxMenuItem(Resources.getString("mnuSetupParseSQLSemicolonLabel")); configParseSemicolons.setMnemonic(Resources.getChar("mnuSetupParseSQLSemicolonAccel")); configParseSemicolons.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuSetupParseSQLSemicolonDesc")); configParseSemicolons.setEnabled(true); menu.add(configParseSemicolons); menu.addSeparator(); // Configuration | Display Column Data Type configDisplayColumnDataType = new JCheckBoxMenuItem(Resources.getString("mnuSetupDispColTypeLabel")); configDisplayColumnDataType.setMnemonic(Resources.getChar("mnuSetupDispColTypeAccel")); configDisplayColumnDataType.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuSetupDispColTypeDesc")); configDisplayColumnDataType.setEnabled(true); configDisplayColumnDataType.setSelected(false); menu.add(configDisplayColumnDataType); // Configuration | Display Client Info configDisplayClientInfo = new JCheckBoxMenuItem(Resources.getString("mnuSetupClientInfoLabel")); configDisplayClientInfo.setMnemonic(Resources.getChar("mnuSetupClientInfoAccel")); configDisplayClientInfo.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuSetupClientInfoDesc")); configDisplayClientInfo.setEnabled(true); configDisplayClientInfo.setSelected(false); menu.add(configDisplayClientInfo); menu.addSeparator(); // Configuration | Save Password configSavePassword = new JCheckBoxMenuItem(Resources.getString("mnuSetupSavePasswordLabel")); configSavePassword.setMnemonic(Resources.getChar("mnuSetupSavePasswordAccel")); configSavePassword.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuSetupSavePasswordDesc")); configSavePassword.setEnabled(true); configSavePassword.setSelected(false); menu.add(configSavePassword); return menu; }
From source file:us.daveread.basicquery.BasicQuery.java
/** * Help menu setup//www . j a v a 2 s . c o m * * @return The help menu */ private JMenu helpMenu() { JMenu menu; // Help Menu menu = new JMenu(Resources.getString("mnuHelpLabel")); menu.setMnemonic(Resources.getChar("mnuHelpAccel")); menu.getAccessibleContext().setAccessibleDescription(Resources.getString("mnuHelpDesc")); // Help | Parameterized SQL Statement helpParameterizedSQL = new JMenuItem(Resources.getString("mnuHelpParamSQLLabel")); helpParameterizedSQL.setMnemonic(Resources.getChar("mnuHelpParamSQLAccel")); helpParameterizedSQL.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuHelpParamSQLDesc")); helpParameterizedSQL.addActionListener(this); helpParameterizedSQL.setEnabled(true); menu.add(helpParameterizedSQL); menu.addSeparator(); // Help | About helpAbout = new JMenuItem(Resources.getString("mnuHelpAboutLabel")); helpAbout.setMnemonic(Resources.getChar("mnuHelpAboutAccel")); helpAbout.getAccessibleContext().setAccessibleDescription(Resources.getString("mnuHelpAboutDesc")); helpAbout.addActionListener(this); helpAbout.setEnabled(true); menu.add(helpAbout); return menu; }