Package java.awt

Examples of java.awt.Menu$State


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

        addMenuItems(menu, extras);
        bar.add(menu);
        fMain.setMenuBar(bar);
        initGUI();
View Full Code Here


        q.init();
        q.start();
        fMain.add("Center", q);

        MenuBar menu = new MenuBar();
        Menu    file = new Menu("File");

        file.add("Exit");
        file.addActionListener(q);
        menu.add(file);
        fMain.setMenuBar(menu);
        fMain.setSize(500, 400);
        fMain.show();
        fMain.addWindowListener(q);
View Full Code Here

    super.initialize(type, oldInstance, newInstance, enc);
    if (type != oldInstance.getClass()) {
            return;
        }
   
    Menu menu = (Menu) oldInstance;
    int count = menu.getItemCount();
    Expression getterExp = null;
    for (int i = 0; i < count; i++) {
      getterExp = new Expression(menu.getItem(i), "getLabel", null);
      try {
        // Calculate the old value of the property
        Object oldVal = getterExp.getValue();
        // Write the getter expression to the encoder
        enc.writeExpression(getterExp);
        // Get the target value that exists in the new environment
        Object targetVal = enc.get(oldVal);
        // Get the current property value in the new environment
        Object newVal = null;
        try {
          newVal = new Expression(((Menu) newInstance).getItem(i),
              "getLabel", null).getValue();
        } catch (IndexOutOfBoundsException ex) {
          // The newInstance has no elements, so current property
          // value remains null
        }
        /*
         * Make the target value and current property value equivalent
         * in the new environment
         */
        if (null == targetVal) {
          if (null != newVal) {
            // Set to null
            Statement setterStm = new Statement(oldInstance, "insert",
                new Object[] { null, i });
            enc.writeStatement(setterStm);
          }
        } else {
          PersistenceDelegate pd = enc
              .getPersistenceDelegate(targetVal.getClass());
          if (!pd.mutatesTo(targetVal, newVal)) {
            MenuItem menuItem = new MenuItem((String) oldVal);
            menuItem.setName(menu.getItem(i).getName());
            Statement setterStm = new Statement(oldInstance,
                "add", new Object[] { menuItem });
            enc.writeStatement(setterStm);
          }
        }
View Full Code Here

          }
        } else {
          PersistenceDelegate pd = enc
              .getPersistenceDelegate(targetVal.getClass());
          if (!pd.mutatesTo(targetVal, newVal)) {
            Menu menu = new Menu((String) oldVal);
            menu.setName(bar.getMenu(i).getName());
            Statement setterStm = new Statement(oldInstance,
                "add", new Object[] { menu });
            enc.writeStatement(setterStm);
          }
        }
View Full Code Here

                            boolean supportPlainText,
                            int[] menus) {
       
        MenuBar menuBar = new MenuBar();
        String menuTitle = ResourceUtils.getString(EditorResources.FILE);
        Menu menu = new Menu(menuTitle);
        new AwtFileMenuManager(menu, fApplication, this,
                                supportStyledText, supportPlainText);
        menuBar.add(menu);

        AwtMenuBuilder.getInstance().createMenus(menuBar, fTextPanel, this, menus);
View Full Code Here

            "-SCRIPT", "-SET", "-SHUTDOWN", "--", "-Test Script"
        };

        addMenu(bar, "Command", sitems);

        Menu recent = new Menu("Recent");

        mRecent = new Menu("Recent");

        bar.add(mRecent);

        String[] soptions = {
            "-AutoCommit on", "-AutoCommit off", "OCommit", "LRollback", "--",
            "-Disable MaxRows", "-Set MaxRows to 100", "--", "-Logging on",
            "-Logging off", "--", "-Insert test data"
        };

        addMenu(bar, "Options", soptions);

        String[] stools = {
            "-Dump", "-Restore", "-Transfer"
        };

        addMenu(bar, "Tools", stools);

        Menu     hMenu = new Menu("Help");
        MenuItem aItem = new MenuItem("About");

        aItem.setShortcut(new MenuShortcut('A'));
        aItem.addActionListener(this);
        hMenu.add(aItem);

        MenuItem hItem = new MenuItem("Help");

        hItem.setShortcut(new MenuShortcut('H'));
        hItem.addActionListener(this);
        hMenu.add(hItem);

        //bar.add(hMenu);
        // Command above disabled only until a help display bug is fixed.
        fMain.setMenuBar(bar);
        fMain.setSize(640, 480);
View Full Code Here

    void addMenu(MenuBar b, String name, String[] items) {

        /* It's a very poor design to encapsulate menu creation this way.
         * Can't customize the menus this way (e.g. shortcut keys,
         * mnemonics, disabling, etc. */
        Menu menu = new Menu(name);

        if (name.equals("Tools") && !TT_AVAILABLE) {

            // Terrible place to do this.  Forced to due to method design.
            menu.setEnabled(false);
        }

        addMenuItems(menu, items);
        b.add(menu);
    }
View Full Code Here

            "-SHUTDOWN", "--", "-Test Script"
        };

        addMenu(bar, "SQL", sitems);

        Menu recent = new Menu("Recent");

        mRecent = new Menu("Recent");

        bar.add(mRecent);

        String[] soptions = {
            "-AutoCommit on", "-AutoCommit off", "-Commit", "-Rollback", "--",
View Full Code Here

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

        addMenuItems(menu, extras);
        bar.add(menu);
        fMain.setMenuBar(bar);
        initGUI();
View Full Code Here

            "-SCRIPT", "-SET", "-SHUTDOWN", "--", "-Test Script"
        };

        addMenu(bar, "Command", sitems);

        Menu recent = new Menu("Recent");

        mRecent = new Menu("Recent");

        bar.add(mRecent);

        String[] soptions = {
            "-AutoCommit on", "-AutoCommit off", "OCommit", "LRollback", "--",
            "-Disable MaxRows", "-Set MaxRows to 100", "--", "-Logging on",
            "-Logging off", "--", "-Insert test data"
        };

        addMenu(bar, "Options", soptions);

        String[] stools = {
            "-Dump", "-Restore", "-Transfer"
        };

        addMenu(bar, "Tools", stools);

        Menu     hMenu = new Menu("Help");
        MenuItem aItem = new MenuItem("About");

        aItem.setShortcut(new MenuShortcut('A'));
        aItem.addActionListener(this);
        hMenu.add(aItem);

        MenuItem hItem = new MenuItem("Help");

        hItem.setShortcut(new MenuShortcut('H'));
        hItem.addActionListener(this);
        hMenu.add(hItem);

        //bar.add(hMenu);
        // Command above disabled only until a help display bug is fixed.
        fMain.setMenuBar(bar);
        fMain.setSize(640, 480);
View Full Code Here

TOP

Related Classes of java.awt.Menu$State

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