Example usage for javax.swing JMenu getAccessibleContext

List of usage examples for javax.swing JMenu getAccessibleContext

Introduction

In this page you can find the example usage for javax.swing JMenu getAccessibleContext.

Prototype

@BeanProperty(bound = false)
public AccessibleContext getAccessibleContext() 

Source Link

Document

Gets the AccessibleContext associated with this JMenu.

Usage

From source file:edu.brown.gui.CatalogViewer.java

/**
 * /* www. ja v  a 2  s.  com*/
 */
protected void viewerInit() {
    // ----------------------------------------------
    // MENU
    // ----------------------------------------------
    JMenu menu;
    JMenuItem menuItem;

    // 
    // File Menu
    //
    menu = new JMenu("File");
    menu.getPopupMenu().setLightWeightPopupEnabled(false);
    menu.setMnemonic(KeyEvent.VK_F);
    menu.getAccessibleContext().setAccessibleDescription("File Menu");
    menuBar.add(menu);

    menuItem = new JMenuItem("Open Catalog From File");
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, ActionEvent.CTRL_MASK));
    menuItem.getAccessibleContext().setAccessibleDescription("Open Catalog From File");
    menuItem.addActionListener(this.menuHandler);
    menuItem.putClientProperty(MenuHandler.MENU_ID, MenuOptions.CATALOG_OPEN_FILE);
    menu.add(menuItem);

    menuItem = new JMenuItem("Open Catalog From Jar");
    menuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_O, ActionEvent.CTRL_MASK | ActionEvent.SHIFT_MASK));
    menuItem.getAccessibleContext().setAccessibleDescription("Open Catalog From Project Jar");
    menuItem.addActionListener(this.menuHandler);
    menuItem.putClientProperty(MenuHandler.MENU_ID, MenuOptions.CATALOG_OPEN_JAR);
    menu.add(menuItem);

    menu.addSeparator();

    menuItem = new JMenuItem("Quit", KeyEvent.VK_Q);
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, ActionEvent.CTRL_MASK));
    menuItem.getAccessibleContext().setAccessibleDescription("Quit Program");
    menuItem.addActionListener(this.menuHandler);
    menuItem.putClientProperty(MenuHandler.MENU_ID, MenuOptions.QUIT);
    menu.add(menuItem);

    // ----------------------------------------------
    // CATALOG TREE PANEL
    // ----------------------------------------------
    this.catalogTree = new JTree();
    this.catalogTree.setEditable(false);
    this.catalogTree.setCellRenderer(new CatalogViewer.CatalogTreeRenderer());
    this.catalogTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    this.catalogTree.addTreeSelectionListener(new TreeSelectionListener() {
        public void valueChanged(TreeSelectionEvent e) {
            DefaultMutableTreeNode node = (DefaultMutableTreeNode) CatalogViewer.this.catalogTree
                    .getLastSelectedPathComponent();
            if (node == null)
                return;

            Object user_obj = node.getUserObject();
            String new_text = ""; // <html>";
            boolean text_mode = true;
            if (user_obj instanceof WrapperNode) {
                CatalogType catalog_obj = ((WrapperNode) user_obj).getCatalogType();
                new_text += CatalogViewer.this.getAttributesText(catalog_obj);
            } else if (user_obj instanceof AttributesNode) {
                AttributesNode wrapper = (AttributesNode) user_obj;
                new_text += wrapper.getAttributes();

            } else if (user_obj instanceof PlanTreeCatalogNode) {
                final PlanTreeCatalogNode wrapper = (PlanTreeCatalogNode) user_obj;
                text_mode = false;

                CatalogViewer.this.mainPanel.remove(0);
                CatalogViewer.this.mainPanel.add(wrapper.getPanel(), BorderLayout.CENTER);
                CatalogViewer.this.mainPanel.validate();
                CatalogViewer.this.mainPanel.repaint();

                if (SwingUtilities.isEventDispatchThread() == false) {
                    SwingUtilities.invokeLater(new Runnable() {
                        public void run() {
                            wrapper.centerOnRoot();
                        }
                    });
                } else {
                    wrapper.centerOnRoot();
                }

            } else {
                new_text += CatalogViewer.this.getSummaryText();
            }

            // Text Mode
            if (text_mode) {
                if (CatalogViewer.this.text_mode == false) {
                    CatalogViewer.this.mainPanel.remove(0);
                    CatalogViewer.this.mainPanel.add(CatalogViewer.this.textInfoPanel);
                }
                CatalogViewer.this.textInfoTextArea.setText(new_text);

                // Scroll to top
                CatalogViewer.this.textInfoTextArea.grabFocus();
            }

            CatalogViewer.this.text_mode = text_mode;
        }
    });
    this.generateCatalogTree(this.catalog, this.catalog_file_path.getName());

    //
    // Text Information Panel
    //
    this.textInfoPanel = new JPanel();
    this.textInfoPanel.setLayout(new BorderLayout());
    this.textInfoTextArea = new JTextArea();
    this.textInfoTextArea.setEditable(false);
    this.textInfoTextArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12));
    this.textInfoTextArea.setText(this.getSummaryText());
    this.textInfoTextArea.addFocusListener(new FocusListener() {
        @Override
        public void focusLost(FocusEvent e) {
            // TODO Auto-generated method stub
        }

        @Override
        public void focusGained(FocusEvent e) {
            CatalogViewer.this.scrollTextInfoToTop();
        }
    });
    this.textInfoScroller = new JScrollPane(this.textInfoTextArea);
    this.textInfoPanel.add(this.textInfoScroller, BorderLayout.CENTER);
    this.mainPanel = new JPanel(new BorderLayout());
    this.mainPanel.add(textInfoPanel, BorderLayout.CENTER);

    //
    // Search Toolbar
    //
    JPanel searchPanel = new JPanel();
    searchPanel.setLayout(new BorderLayout());
    JPanel innerSearchPanel = new JPanel();
    innerSearchPanel.setLayout(new BoxLayout(innerSearchPanel, BoxLayout.X_AXIS));
    innerSearchPanel.add(new JLabel("Search: "));
    this.searchField = new JTextField(30);
    innerSearchPanel.add(this.searchField);
    searchPanel.add(innerSearchPanel, BorderLayout.EAST);

    this.searchField.addKeyListener(new KeyListener() {
        private String last = null;

        @Override
        public void keyReleased(KeyEvent e) {
            String value = CatalogViewer.this.searchField.getText().toLowerCase().trim();
            if (!value.isEmpty() && (this.last == null || !this.last.equals(value))) {
                CatalogViewer.this.search(value);
            }
            this.last = value;
        }

        @Override
        public void keyTyped(KeyEvent e) {
            // Do nothing...
        }

        @Override
        public void keyPressed(KeyEvent e) {
            // Do nothing...
        }
    });

    // Putting it all together
    JScrollPane scrollPane = new JScrollPane(this.catalogTree);
    JPanel topPanel = new JPanel();
    topPanel.setLayout(new BorderLayout());
    topPanel.add(searchPanel, BorderLayout.NORTH);
    topPanel.add(scrollPane, BorderLayout.CENTER);

    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, topPanel, this.mainPanel);
    splitPane.setDividerLocation(400);

    this.add(splitPane, BorderLayout.CENTER);
}

From source file:com.gele.tools.wow.wdbearmanager.WDBearManager.java

public void init(String[] args) {

    // copy ARGs//w w  w.j  av  a 2  s  .c om
    this.parseCommandLine(args);

    // Usefull for debugging
    this.myLogger.debug("java.version: " + System.getProperty("java.version"));
    this.myLogger.debug("java.vendor: " + System.getProperty("java.vendor"));
    this.myLogger.debug("java.vendor.url: " + System.getProperty("java.vendor.url"));
    this.myLogger.debug("os.name: " + System.getProperty("os.name"));
    this.myLogger.debug("os.arch: " + System.getProperty("os.arch"));
    this.myLogger.debug("os.version: " + System.getProperty("os.version"));

    if (this.paramDBconfig.length() != 0) {
        this.WDB_DB_CONFIG_FILE = this.paramDBconfig;
    }

    WDBearManager_API myAPI = new WDBearManager_API(this.WDB_DB_CONFIG_FILE);

    // Create all tables
    // -> Needed for the updata script <-
    // -> Otherwise it may crash with an empty database
    try {
        myAPI.getCountOfTable("creaturecache");
        myAPI.getCountOfTable("gameobjectcache");
        myAPI.getCountOfTable("itemcache");
        myAPI.getCountOfTable("itemnamecache");
        myAPI.getCountOfTable("itemtextchaxhe");
        myAPI.getCountOfTable("npccache");
        myAPI.getCountOfTable("pagetextcache");
        myAPI.getCountOfTable("questcache");
    } catch (Exception ex) {
        // ignore
        ex.printStackTrace();
        System.exit(0);
    }

    // Check, if database must be re-newed
    DBUpdater myDBU = new DBUpdater();
    myDBU.checkForUpdate(myAPI);

    WDBearManager_I myWoWWDBearManager_API = myAPI;

    //
    // print out some statistics
    //

    if (this.useGUI == false) {

        boolean paramSpec = false;
        // ASSERT
        DTO_Interface myDTO = null;

        if (this.paramWdbfile.length() != 0) {
            paramSpec = true;
            // Open WDB
            try {
                this.items = myWoWWDBearManager_API.readWDBfile(this.paramWdbfile);
            } catch (Exception ex) {
                this.myLogger.error("Error reading the WDB file");
                return;
            }
            // first dto -> to identify the data
            Iterator itWDBS = this.items.iterator();
            if (itWDBS.hasNext()) {
                myDTO = (DTO_Interface) itWDBS.next();
            }
        }
        // Create CSV?
        if (this.paramCSVFolder.length() != 0) {
            if (myDTO == null) {
                // NO WDB specified -> exit
                this.myLogger.error("Error: You did not specify -" + this.PARAM_WDBFILE + "\n");
                usage(this.options);
                return;
            }
            File csvFile = new File(this.paramCSVFolder, myDTO.getTableName() + ".csv");
            if (this.useVerbose) {
                this.myLogger.info("Creating CSV file: " + csvFile.getAbsolutePath());
            }
            try {
                WriteCSV.writeCSV(new File(this.paramCSVFolder), this.items);
                this.myLogger.info("CSV file written: " + csvFile.getAbsolutePath());
            } catch (Exception ex) {
                ex.printStackTrace();
                this.myLogger.error("Error writing the CSV file");
                return;
            }
        }
        // Create TXT?
        if (this.paramTXTFolder.length() != 0) {
            if (myDTO == null) {
                // NO WDB specified -> exit
                this.myLogger.error("Error: You did not specify -" + this.PARAM_WDBFILE + "\n");
                usage(this.options);
                return;
            }
            if (this.useVerbose) {
                String table = myDTO.getTableName();
                File txtFile = new File(this.paramTXTFolder, table + ".txt");
                this.myLogger.info("Creating TXT file: " + txtFile.getAbsolutePath());
            }
            try {
                WriteTXT.writeTXT(new File(this.paramTXTFolder), this.items);
            } catch (Exception ex) {
                //ex.printStackTrace();
                this.myLogger.error("Error writing the TXT file: " + ex.getMessage());
                return;
            }
        }
        // Store inside SQL database?
        if (this.writeSQL == true) {
            paramSpec = true;
            if (myDTO == null) {
                // NO WDB specified -> exit
                this.myLogger.error("Error: You did not specify -" + this.PARAM_WDBFILE + "\n");
                usage(this.options);
                return;
            }
            if (this.useVerbose) {
                this.myLogger.info("Storing data inside SQL database");
            }
            SQLManager myWriteSQL = null;
            try {
                myWriteSQL = new SQLManager(this.WDB_DB_CONFIG_FILE);
                ObjectsWritten myOWr = myWriteSQL.insertOrUpdateToSQLDB(this.items, this.doUpdate);
                this.myLogger.info("Operation successfull");
                if (this.useVerbose) {
                    this.myLogger.info("DB statistics");
                    this.myLogger.info("INSERT: " + myOWr.getNumInsert());
                    this.myLogger.info("UPDATE: " + myOWr.getNumUpdate());
                    this.myLogger.info("Error INSERT: " + myOWr.getNumErrorInsert());
                    this.myLogger.info("Error UPDATE: " + myOWr.getNumErrorUpdate());
                    if (this.doUpdate == false) {
                        this.myLogger.info("Objects skipped: " + myOWr.getNumSkipped());
                        System.out.println("If you want to overwrite/update objects, use 'update' param");
                    }
                    this.myLogger.info(WDBearManager.VERSION_INFO);
                }
            } catch (Exception ex) {
                ex.printStackTrace();
                this.myLogger.error("Error importing to database");
                this.myLogger.error(ex.getMessage());
                return;
            }
        } // writeSQL

        // Patch *.SCP with contents of database
        if (this.paramSCPname.length() != 0) {
            if (this.paramPatchSCP.length() == 0) {
                this.myLogger.error("Error: You did not specify -" + WDBearManager.PATCH_SCP + "\n");
                usage(this.options);
                return;
            }

            paramSpec = true;
            this.myLogger.info("Patch scp file with the contents of the database");
            try {

                SCPWritten mySCPW = myWoWWDBearManager_API.patchSCP(this.paramSCPname, this.paramPatchSCP,
                        this.patchUTF8, this.paramLocale);
                if (this.useVerbose) {
                    this.myLogger.info("Merge statistics");
                    System.out.println("Entries in database:    " + mySCPW.getNumInDB());
                    this.myLogger.info("Merged with SCP: " + mySCPW.getNumPatched());
                    this.myLogger.info("Patched IDs:      " + mySCPW.getPatchedIDs());
                }
                this.myLogger.info("Patched file: " + this.paramSCPname + "_patch");
            } catch (WDBMgr_IOException ex) {
                this.myLogger.error("The destination SCP file could not be created");
                this.myLogger.error(ex.getMessage());
                return;
            } catch (WDBMgr_NoDataAvailableException ex) {
                this.myLogger.info("Merging impossible");
                this.myLogger.info("There are no entries inside the database");
            } catch (Exception ex) {
                this.myLogger.error("Error while merging quests.scp with database");
                this.myLogger.error(ex.getMessage());
                return;
            }
        } // PatchSCP

        // Call jython script?
        if (this.paramScript.length() != 0) {
            paramSpec = true;
            this.myLogger.info("Calling Jython script");
            this.myLogger.info("---");
            PythonInterpreter interp = new PythonInterpreter();

            interp.set("wdbmgrapi", myWoWWDBearManager_API);
            // set parameters
            Set setKeys = this.paramJython.keySet();
            Iterator itKeys = setKeys.iterator();
            String jyParam = "";
            while (itKeys.hasNext()) {
                jyParam = (String) itKeys.next();
                interp.set(jyParam, (String) this.paramJython.get(jyParam));
            }
            interp.execfile(this.paramScript);

            this.myLogger.info("---");
            System.out.println("Jython script executed, " + WDBearManager.VERSION_INFO);
            return;
        } // paramScript

        if (paramSpec == false) {
            usage(this.options);
            return;
        }

        // Exit
        return;
    } // Command Line Version

    //
    // GUI
    //
    PlasticLookAndFeel.setMyCurrentTheme(new DesertBlue());
    try {
        UIManager.put("ClassLoader", LookUtils.class.getClassLoader());
        UIManager.setLookAndFeel(new Plastic3DLookAndFeel());
    } catch (Exception e) {
    }
    //    try {
    //      com.incors.plaf.kunststoff.KunststoffLookAndFeel kunststoffLnF = new com.incors.plaf.kunststoff.KunststoffLookAndFeel();
    //      KunststoffLookAndFeel
    //          .setCurrentTheme(new com.incors.plaf.kunststoff.KunststoffTheme());
    //      UIManager.setLookAndFeel(kunststoffLnF);
    //    } catch (javax.swing.UnsupportedLookAndFeelException ex) {
    //      // handle exception or not, whatever you prefer
    //    }
    //     this line needs to be implemented in order to make JWS work properly
    UIManager.getLookAndFeelDefaults().put("ClassLoader", getClass().getClassLoader());

    this.setTitle(WDBearManager.VERSION_INFO);
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    this.getContentPane().setLayout(new BorderLayout());

    // construct GUI to display the stuff
    // Menu
    //  Where the GUI is created:
    JMenuBar menuBar;
    JMenu menu; //, submenu;
    JMenuItem menuItem;
    //JRadioButtonMenuItem rbMenuItem;
    //JCheckBoxMenuItem cbMenuItem;

    //    Create the menu bar.
    menuBar = new JMenuBar();

    //    Build the first menu.
    menu = new JMenu("File");
    menu.setMnemonic(KeyEvent.VK_A);
    menu.getAccessibleContext().setAccessibleDescription("Process WDB files");
    menuBar.add(menu);

    // Exit
    menuItem = new JMenuItem(MENU_EXIT, KeyEvent.VK_T);
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F4, ActionEvent.ALT_MASK));
    menuItem.getAccessibleContext().setAccessibleDescription("Exit program");
    menuItem.addActionListener(this);
    menu.add(menuItem);

    //    Build the first menu.
    menu = new JMenu("About");
    menu.setMnemonic(KeyEvent.VK_A);
    menu.getAccessibleContext().setAccessibleDescription("Whassup?");
    menuBar.add(menu);
    // Help
    menuItem = new JMenuItem(MENU_HELP, KeyEvent.VK_H);
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_H, ActionEvent.ALT_MASK));
    menuItem.getAccessibleContext().setAccessibleDescription("Help me...");
    menuItem.addActionListener(this);
    menu.add(menuItem);
    // JavaDocs
    menuItem = new JMenuItem(MENU_JDOCS, KeyEvent.VK_J);
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_J, ActionEvent.ALT_MASK));
    menuItem.getAccessibleContext().setAccessibleDescription("Show API docs...");
    menuItem.addActionListener(this);
    menu.add(menuItem);
    // separator
    menu.addSeparator();
    // CheckForUpdate
    menuItem = new JMenuItem(MENU_CHECKUPDATE, KeyEvent.VK_U);
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_U, ActionEvent.ALT_MASK));
    menuItem.getAccessibleContext().setAccessibleDescription("Check for update...");
    menuItem.addActionListener(this);
    menu.add(menuItem);
    // separator
    menu.addSeparator();
    // ABOUT
    menuItem = new JMenuItem(MENU_ABOUT, KeyEvent.VK_T);
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_T, ActionEvent.ALT_MASK));
    menuItem.getAccessibleContext().setAccessibleDescription("Ueber...");
    menuItem.addActionListener(this);
    menu.add(menuItem);

    this.setJMenuBar(menuBar);

    JPanel mainPanel = new JPanel();
    mainPanel.setLayout(new GridLayout(0, 1));

    JTabbedPane tabbedPane = new JTabbedPane();
    ImageIcon wowIcon = createImageIcon("images/fromdisk.gif");

    JComponent panel1 = new WDB_Panel(myWoWWDBearManager_API);
    tabbedPane.addTab("WDB-Module", wowIcon, panel1, "Handle WDB files");
    tabbedPane.setMnemonicAt(0, KeyEvent.VK_1);

    ImageIcon panelIcon = createImageIcon("images/hsql.gif");
    JComponent panel2 = null;
    try {
        panel2 = new SQL_Panel(myWoWWDBearManager_API);
    } catch (Throwable ex) {
        System.err.println("Error while instantiating SQL Panel: ");
        System.err.println(ex.getMessage());
        ex.printStackTrace();
        System.exit(0);
    }
    tabbedPane.addTab("DB-Module", panelIcon, panel2, "Handle database");
    tabbedPane.setMnemonicAt(1, KeyEvent.VK_2);

    panelIcon = createImageIcon("images/pythonpoweredsmall.gif");
    JComponent panel3 = new Python_Panel(myWoWWDBearManager_API);
    tabbedPane.addTab("Scripts", panelIcon, panel3, "Scripting");
    tabbedPane.setMnemonicAt(2, KeyEvent.VK_3);

    // maybe user PLUGIN availabe
    // -> check for folders below "plugins"
    File filUserPanels = new File("plugins");
    // 1) find user plugins (scan for directories)
    // 2) scan for <name>.properties, where <name> is the name of the directory
    // 3) load the properties file and get the plugin running
    String[] strUserPlugins = filUserPanels.list(new FilenameFilter() {
        public boolean accept(File dir, String name) {
            return (new File(dir, name).isDirectory());
        }
    });
    if (strUserPlugins != null) {
        ArrayList urlJars = new ArrayList();

        //URL[] urlJars = new URL[strUserPlugins.length];
        String strCurrJar = "";
        String strPlugins[] = new String[strUserPlugins.length];
        try {
            for (int i = 0; i < strUserPlugins.length; i++) {
                File baseFile = new File("plugins", strUserPlugins[i]);
                File filProperties = new File(baseFile, strUserPlugins[i] + ".properties");
                if (filProperties.exists()) {
                    // set plugin folder and .properties name
                    strPlugins[i] = strUserPlugins[i];
                    this.myLogger.info("Found 'plugin' : " + baseFile.getAbsolutePath());
                    this.myLogger.info("                 Trying to load .jar file");

                    // Scan for JAR files and include them
                    //System.out.println(baseFile.getAbsolutePath());
                    String[] strJars = baseFile.list(new FilenameFilter() {
                        public boolean accept(File dir, String name) {
                            return name.endsWith(".jar");
                        }
                    });
                    for (int j = 0; j < strJars.length; j++) {
                        File filJAR = new File(baseFile, strJars[j]);
                        strCurrJar = filJAR.getAbsolutePath();

                        this.myLogger.info("Loading external 'plugin' JAR: " + strCurrJar);
                        URL jarfile = new URL("jar", "", "file:" + strCurrJar + "!/");
                        urlJars.add(jarfile);
                    }

                } else {
                    // print warning - a directory inside plugins, but there is no plugin
                    this.myLogger.warn("Found directory inside plugins folder, but no .properties file");
                    this.myLogger.warn("      Name of directory: " + strUserPlugins[i]);
                    this.myLogger.warn("      Please review the directory!");
                }
            } // for... all user plugins
        } catch (Exception ex) {
            this.myLogger.error("Plugin: Error loading " + strCurrJar);
            this.myLogger.error("Please check your 'plugin' folder");
        }
        URLClassLoader cl = null;
        try {
            //      File file = new File("plugins", strUserJars[i]);
            //      this.myLogger.info("Lade externes JAR: " + file.getAbsolutePath());
            //      URL jarfile = new URL("jar", "", "file:" + file.getAbsolutePath() + "!/");
            URL[] loadURLs = new URL[urlJars.toArray().length];
            for (int j = 0; j < urlJars.toArray().length; j++) {
                loadURLs[j] = (URL) urlJars.get(j);
            }
            cl = URLClassLoader.newInstance(loadURLs);

            Thread.currentThread().setContextClassLoader(cl);

            //      String lcStr = "Test";
            //      Class loadedClass = cl.loadClass(lcStr);
            //      this.myLogger.info("Smooth...");

        } catch (Exception ex) {
            ex.printStackTrace();
        }

        // 2) load properties and instantiate the plugin
        //      String[] strPlugins = filUserPanels.list(new FilenameFilter() {
        //        public boolean accept(File dir, String name) {
        //          return (name.endsWith("_plugin.properties"));
        //        }
        //      });
        String strPluginName = "";
        String strPluginClass = "";
        String strPluginImage = "";
        WDBearPlugin pluginPanel = null;
        for (int i = 0; i < strPlugins.length; i++) {
            //this.myLogger.info(strPlugins[i]);
            Properties prpPlugin = null;
            try {
                prpPlugin = ReadPropertiesFile.readProperties(
                        new File("plugins", strPlugins[i] + "/" + strPlugins[i]).getAbsolutePath()
                                + ".properties");
            } catch (Exception ex) {
                this.myLogger.error("Error with plugin: " + strPlugins[i]);
                this.myLogger.error("Could not load properties file");
                continue;
            }
            if ((strPluginClass = prpPlugin.getProperty(this.PLUGIN_CLASS)) == null) {
                this.myLogger.error("Error with plugin: " + strPlugins[i]);
                this.myLogger.error("Property '" + this.PLUGIN_CLASS + "' not found");
                continue;
            }
            if ((strPluginName = prpPlugin.getProperty(this.PLUGIN_NAME)) == null) {
                this.myLogger.error("Error with plugin: " + strPlugins[i]);
                this.myLogger.error("Property '" + this.PLUGIN_NAME + "' not found");
                continue;
            }
            if ((strPluginImage = prpPlugin.getProperty(this.PLUGIN_IMAGE)) == null) {
                this.myLogger.error("Error with plugin: " + strPlugins[i]);
                this.myLogger.error("Property '" + this.PLUGIN_IMAGE + "' not found");
                continue;
            }

            File filPlgImg = new File("plugins", strPlugins[i] + "/" + strPluginImage);
            panelIcon = createImageIcon(filPlgImg.getAbsolutePath());
            if (panelIcon == null) {
                this.myLogger.error("Error with plugin: " + strPlugins[i]);
                this.myLogger.error("Could not read image '" + strPluginImage + "'");
                continue;
            }
            try {
                pluginPanel = (WDBearPlugin) (cl.loadClass(strPluginClass).newInstance());
                pluginPanel.runPlugin(myAPI);
            } catch (Exception ex) {
                this.myLogger.error("Error with plugin: " + strPlugins[i]);
                this.myLogger.error("Could not instantiate '" + strPluginClass + "'");
                ex.printStackTrace();
                continue;
            }
            tabbedPane.addTab(strPluginName, panelIcon, pluginPanel, strPluginName);
        } // Plugins
    } // plugins folder found

    mainPanel.add(tabbedPane);

    this.getContentPane().add(mainPanel, BorderLayout.CENTER);

    this.setSize(1024, 768);
    //this.pack();
    this.show();

}

From source file:us.daveread.basicquery.BasicQuery.java

/**
 * File menu setup//ww w . j av  a2 s .  c  om
 * 
 * @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  www.ja va  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//from  ww  w. j a va  2 s . c o m
 * 
 * @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/*w  ww.j a  v  a 2s .  co 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  w w w.  j av a2s  .com
 * 
 * @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/*from w w w  .  j av 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;
}