You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by sm...@apache.org on 2012/01/19 01:51:42 UTC

svn commit: r1233143 [25/47] - in /pivot/site/trunk/deploy: ./ 2.0.1/ 2.0.1/docs/ 2.0.1/docs/api/ demos/ tutorials/

Modified: pivot/site/trunk/deploy/tutorials/menu-bars.html
URL: http://svn.apache.org/viewvc/pivot/site/trunk/deploy/tutorials/menu-bars.html?rev=1233143&r1=1233142&r2=1233143&view=diff
==============================================================================
--- pivot/site/trunk/deploy/tutorials/menu-bars.html (original)
+++ pivot/site/trunk/deploy/tutorials/menu-bars.html Thu Jan 19 00:51:39 2012
@@ -1,4 +1,4 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <!--
 Licensed to the Apache Software Foundation (ASF) under one or more
 contributor license agreements.  See the NOTICE file distributed with
@@ -14,348 +14,350 @@ distributed under the License is distrib
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
---><html xmlns="http://www.w3.org/1999/xhtml"><head><meta content="text/html; charset=UTF-8" http-equiv="Content-Type" /><title>Menu Bars | Apache Pivot</title><link xmlns="" type="text/css" rel="stylesheet" href="/styles/pivot.css"><script xmlns="http://www.w3.org/1999/xhtml" type="text/javascript">
-                var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
-                document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
-                </script><script type="text/javascript">
-                try {
-                var pageTracker = _gat._getTracker("UA-7977275-3");
-                pageTracker._trackPageview();
-                } catch(err) {}</script></head><body><div xmlns="" id="wrapper"><div id="main"><div id="header"><div class="logo"><a href="/index.html"><img title="Apache Pivot Homepage" alt="Apache Pivot" src="/images/logo.png"></a></div><div class="tagline"><img style="visibility:hidden" alt="Rich Internet Applications in Java" src="/images/tagline.png"></div><ul class="navi"><li><a href="/demos/">Demos</a></li><li><a href="/download.cgi#2.0">Download</a></li><li><a href="/tutorials/">Tutorial</a></li><li><a href="/get-involved.html">Get Involved</a></li><li><a href="/about.html">About</a></li></ul></div><div class="group" id="contentBase"><h1>Menu Bars</h1><ul class="naviLeft"><li><a href="/tutorials/sample-application.html">Sample Application</a></li><li><a href="/tutorials/platform-overview.html">Platform Overview</a></li><li><a href="/tutorials/hello-world.html">Hello, World!</a></li><li><a href="/tutorials/hello-bxml.html">Hello, BXML!</a></li><li><a href="/tutorials/
 component-and-container.html">Component &amp; Container</a></li><li><a href="/tutorials/labels-and-image-views.html">Labels &amp; Image Views</a></li><li><a href="/tutorials/svg-images.html">SVG Images</a></li><li><a href="/tutorials/buttons.html">Buttons</a></li><li><a href="/tutorials/push-buttons.html">Push Buttons</a></li><li><a href="/tutorials/toggle-buttons.html">Toggle Buttons</a></li><li><a href="/tutorials/radio-buttons.html">Radio Buttons</a></li><li><a href="/tutorials/checkboxes.html">Checkboxes</a></li><li><a href="/tutorials/link-buttons.html">Link Buttons</a></li><li><a href="/tutorials/lists.html">Lists</a></li><li><a href="/tutorials/list-buttons.html">List Buttons</a></li><li><a href="/tutorials/repeatable-list-buttons.html">Repeatable List Buttons</a></li><li><a href="/tutorials/text.html">Text</a></li><li><a href="/tutorials/suggestion-popups.html">Suggestion Popups</a></li><li><a href="/tutorials/text-areas.html">Text Areas</a></li><li><a href="/tutoria
 ls/separators.html">Separators</a></li><li><a href="/tutorials/layout-containers.html">Layout Containers</a></li><li><a href="/tutorials/flow-panes.html">Flow Panes</a></li><li><a href="/tutorials/box-panes.html">Box Panes</a></li><li><a href="/tutorials/grid-panes.html">Grid Panes</a></li><li><a href="/tutorials/table-panes.html">Table Panes</a></li><li><a href="/tutorials/borders.html">Borders</a></li><li><a href="/tutorials/stack-panes.html">Stack Panes</a></li><li><a href="/tutorials/split-panes.html">Split Panes</a></li><li><a href="/tutorials/forms.html">Forms</a></li><li><a href="/tutorials/panels.html">Panels</a></li><li><a href="/tutorials/navigation-containers.html">Navigation Containers</a></li><li><a href="/tutorials/card-panes.html">Card Panes</a></li><li><a href="/tutorials/tab-panes.html">Tab Panes</a></li><li><a href="/tutorials/accordions.html">Accordions</a></li><li><a href="/tutorials/expanders.html">Expanders</a></li><li><a href="/tutorials/rollups.html">
 Rollups</a></li><li><a href="/tutorials/viewports.html">Viewports</a></li><li><a href="/tutorials/scroll-panes.html">Scroll Panes</a></li><li><a href="/tutorials/panoramas.html">Panoramas</a></li><li><a href="/tutorials/progress-indicators.html">Progress Indicators</a></li><li><a href="/tutorials/meters.html">Meters</a></li><li><a href="/tutorials/activity-indicators.html">Activity Indicators</a></li><li><a href="/tutorials/bounded-range-components.html">Bounded Range Components</a></li><li><a href="/tutorials/sliders.html">Sliders</a></li><li><a href="/tutorials/scroll-bars.html">Scroll Bars</a></li><li><a href="/tutorials/spinners.html">Spinners</a></li><li><a href="/tutorials/calendars.html">Calendars</a></li><li><a href="/tutorials/menus.html">Menus</a></li><li><a href="/tutorials/context-menus.html">Context Menus</a></li><li><a href="/tutorials/menu-bars.html">Menu Bars</a></li><li><a href="/tutorials/menu-buttons.html">Menu Buttons</a></li><li><a href="/tutorials/color
 -choosers.html">Color Choosers</a></li><li><a href="/tutorials/table-views.html">Table Views</a></li><li><a href="/tutorials/table-views.json.html">JSON-based TableView</a></li><li><a href="/tutorials/table-views.custom.html">Custom TableView</a></li><li><a href="/tutorials/tree-views.html">Tree Views</a></li><li><a href="/tutorials/file-browsing.html">File Browsing</a></li><li><a href="/tutorials/windows.html">Windows</a></li><li><a href="/tutorials/clipboard.html">Clipboard</a></li><li><a href="/tutorials/drag-and-drop.html">Drag and Drop</a></li><li><a href="/tutorials/effects.html">Effects</a></li><li><a href="/tutorials/effects.transitions.html">Transitions</a></li><li><a href="/tutorials/data-binding.html">Data Binding</a></li><li><a href="/tutorials/property-binding.html">Property Binding</a></li><li><a href="/tutorials/localization.html">Localization</a></li><li><a href="/tutorials/background-tasks.html">Background Tasks</a></li><li><a href="/tutorials/web-queries.ht
 ml">Web Queries</a></li><li><a href="/tutorials/query-servlet.html">QueryServlet</a></li><li><a href="/tutorials/scripting.html">Scripting</a></li><li><a href="/tutorials/summary.html">Summary</a></li><li><a href="/tutorials/stock-tracker.html">The "Stock Tracker" Application</a></li><li><a href="/tutorials/stock-tracker.ui.html">UI Markup Using BXML</a></li><li><a href="/tutorials/stock-tracker.events.html">Event Handling</a></li><li><a href="/tutorials/stock-tracker.web-queries.html">Web Queries</a></li><li><a href="/tutorials/stock-tracker.data-binding.html">Data Binding</a></li><li><a href="/tutorials/stock-tracker.localization.html">Localization</a></li><li><a href="/tutorials/bxml-primer.html">BXML Primer</a></li></ul><div class="content"><style type="text/css">
-            applet {
-                border: 1px solid #999999;
-            }
-        </style><!--NOTE: Syntax highlighting script is LGPL--><script src="http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js" type="text/javascript"></script><script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJava.js" type="text/javascript"></script><script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushXml.js" type="text/javascript"></script><script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJScript.js" type="text/javascript"></script><link href="http://alexgorbatchev.com/pub/sh/current/styles/shCore.css" rel="stylesheet" type="text/css"><link href="http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css" rel="stylesheet" type="text/css"><script type="text/javascript">
-            SyntaxHighlighter.all();
-        </script><div class="section">
-        <p>
-            Menu bars are generally used to provide convenient access to major application
-            features. They act as a repository for top-level hierarchical menus, keeping the menus
-            out of sight until they are needed.
-        </p>
-
-        <p>
-            Like all other components, menu bars can actually be placed anywhere in an
-            application's user interface. However, they are most often located at the top of an
-            application's main window. Pivot provides framework-level support for simplifying the
-            task of defining a menu bar positioned in this way. The <tt>Frame</tt> class defines
-            a "menuBar" property that is handled specially by the application using the
-            <tt>configureMenuBar()</tt> and <tt>cleanupMenuBar()</tt> methods of the
-            <tt>MenuHandler</tt> interface. These methods are called by the framework as the focus
-            changes within a window, to allow the application to customize the contents of the menu
-            bar based on the currently focused component.
-        </p>
-
-        <p>
-            The example application below shows a menu bar containing two common top-level menu
-            items: "File" and "Edit" (note that the applet is signed since it makes use of the
-            <tt>FileBrowserSheet</tt> component, which requires access to the local file system):
-        </p>
-
-        <script src="http://java.com/js/deployJava.js" type="text/javascript"></script><script type="text/javascript">
-
-            var attributes = {
-                code:"org.apache.pivot.wtk.BrowserApplicationContext$HostApplet",
-                width:"640",
-                height:"480"
-            };
-
-
-
-
-
-            var libraries = [];
-            libraries.push("/lib/pivot-core-2.0.signed.jar");
-                libraries.push("/lib/pivot-wtk-2.0.signed.jar");
-                libraries.push("/lib/pivot-wtk-terra-2.0.signed.jar");
-                libraries.push("/lib/pivot-tutorials-2.0.signed.jar");
-
-                    libraries.push("/lib/svgSalamander-tiny.signed.jar");
-
-
-            attributes.archive = libraries.join(",");
-
-
-            var parameters = {
-                codebase_lookup:false,
-                application_class_name:'org.apache.pivot.wtk.ScriptApplication'
-            };
-
-
-            var javaArguments = ["-Dsun.awt.noerasebackground=true",
-                "-Dsun.awt.erasebackgroundonresize=true"];
-
-
-
-            parameters.java_arguments = javaArguments.join(" ");
-
-
-
-                var startupProperties = [];
-
-                    startupProperties.push("src=/org/apache/pivot/tutorials/menus/menu_bars.bxml");
-
-                parameters.startup_properties = startupProperties.join("&");
-
-
-            deployJava.runApplet(attributes, parameters, "1.6");
-        </script>
-
-        <p>
-            Each sub-menu item is associated with an <tt>Action</tt> that is executed when the
-            item is selected. For example, the action attached to the "File &gt; Open" menu item
-            simulates opening a document by showing a file browser sheet and adding a new tab to
-            the application's tab pane. Each component in the "document" has a menu handler
-            attached to it that configures the menu contents as appropriate for the current
-            selection. When a text input component has the focus, the "Paste" menu item is enabled.
-            If text is selected in the text input, the "Cut" and "Copy" menu items are also
-            enabled.
-        </p>
-
-        <p>
-            The BXML source for this example is shown below. It creates the initial menu structure
-            as well as the tab pane that will host the simulated documents. It also defines a set
-            of "action mappings" in the root frame's "actionMappings" sequence. Action mappings
-            associate keystrokes with actions; when a keystroke matching an action in the sequence
-            is processed by the window, the action is invoked. Action mappings are often called
-            "keyboard shortcuts".
-        </p>
-
-        <p>
-            Note that the actions in this example are associated with the "CMD" key. This is a
-            Pivot-specific, platform-independent modifier. It maps to the Control key (CTRL)
-            on Windows and Linux and the Command key (META) on Mac OS X:
-        </p>
-
-        <pre class="brush:xml">
-
-            &lt;menus:MenuBars title="Menu Bars" maximized="true"
-                styles="{padding:{top:0, left:4, bottom:4, right:4}, showWindowControls:false}"
-                xmlns:bxml="http://pivot.apache.org/bxml"
-                xmlns:content="org.apache.pivot.wtk.content"
-                xmlns:menus="org.apache.pivot.tutorials.menus"
-                xmlns="org.apache.pivot.wtk"&gt;
-                &lt;bxml:define&gt;
-                    &lt;FileBrowserSheet bxml:id="fileBrowserSheet"/&gt;
-                &lt;/bxml:define&gt;
-
-                &lt;actionMappings&gt;
-                    &lt;Window.ActionMapping action="fileNew" keyStroke="CMD-N"/&gt;
-                    &lt;Window.ActionMapping action="fileOpen" keyStroke="CMD-O"/&gt;
-                &lt;/actionMappings&gt;
-
-                &lt;menuBar&gt;
-                    &lt;MenuBar&gt;
-                        &lt;MenuBar.Item buttonData="File"&gt;
-                            &lt;Menu&gt;
-                                &lt;Menu.Section&gt;
-                                    &lt;Menu.Item action="fileNew"&gt;
-                                        &lt;buttonData&gt;
-                                            &lt;content:MenuItemData text="New" keyboardShortcut="CMD-N"/&gt;
-                                        &lt;/buttonData&gt;
-                                    &lt;/Menu.Item&gt;
-
-                                    &lt;Menu.Item action="fileOpen"&gt;
-                                        &lt;buttonData&gt;
-                                            &lt;content:MenuItemData text="Open" keyboardShortcut="CMD-O"/&gt;
-                                        &lt;/buttonData&gt;
-                                    &lt;/Menu.Item&gt;
-                                &lt;/Menu.Section&gt;
-                            &lt;/Menu&gt;
-                        &lt;/MenuBar.Item&gt;
-
-                        &lt;MenuBar.Item buttonData="Edit"&gt;
-                            &lt;Menu&gt;
-                                &lt;Menu.Section&gt;
-                                    &lt;Menu.Item action="cut"&gt;
-                                        &lt;buttonData&gt;
-                                            &lt;content:MenuItemData text="Cut" keyboardShortcut="CMD-X"/&gt;
-                                        &lt;/buttonData&gt;
-                                    &lt;/Menu.Item&gt;
-                                    &lt;Menu.Item action="copy"&gt;
-                                        &lt;buttonData&gt;
-                                            &lt;content:MenuItemData text="Copy" keyboardShortcut="CMD-C"/&gt;
-                                        &lt;/buttonData&gt;
-                                    &lt;/Menu.Item&gt;
-                                    &lt;Menu.Item action="paste"&gt;
-                                        &lt;buttonData&gt;
-                                            &lt;content:MenuItemData text="Paste" keyboardShortcut="CMD-V"/&gt;
-                                        &lt;/buttonData&gt;
-                                    &lt;/Menu.Item&gt;
-                                &lt;/Menu.Section&gt;
-                            &lt;/Menu&gt;
-                        &lt;/MenuBar.Item&gt;
-                    &lt;/MenuBar&gt;
-                &lt;/menuBar&gt;
-
-                &lt;Border styles="{backgroundColor:null, padding:2}"&gt;
-                    &lt;TabPane bxml:id="tabPane"/&gt;
-                &lt;/Border&gt;
-            &lt;/menus:MenuBars&gt;
-
-        </pre>
-
-        <p>
-            The Java source for the example is shown below. In the constructor, the application's
-            actions are created and added to the global action dictionary. Note that, since the
-            BXML file refers to the actions by ID, it is essential that the actions be available
-            before the BXML is read.
-        </p>
-
-        <pre class="brush:java">
-
-            package org.apache.pivot.tutorials.menus;
-
-            import java.io.IOException;
-            import java.net.URL;
-
-            import org.apache.pivot.beans.BXML;
-            import org.apache.pivot.beans.BXMLSerializer;
-            import org.apache.pivot.beans.Bindable;
-            import org.apache.pivot.collections.Map;
-            import org.apache.pivot.serialization.SerializationException;
-            import org.apache.pivot.util.Resources;
-            import org.apache.pivot.wtk.Action;
-            import org.apache.pivot.wtk.Border;
-            import org.apache.pivot.wtk.Component;
-            import org.apache.pivot.wtk.FileBrowserSheet;
-            import org.apache.pivot.wtk.Frame;
-            import org.apache.pivot.wtk.MenuBar;
-            import org.apache.pivot.wtk.MenuHandler;
-            import org.apache.pivot.wtk.TabPane;
-            import org.apache.pivot.wtk.TextInput;
-            import org.apache.pivot.wtk.TextInputSelectionListener;
-            import org.apache.pivot.wtk.TextInputContentListener;
-
-            public class MenuBars extends Frame implements Bindable {
-                @BXML private FileBrowserSheet fileBrowserSheet;
-                @BXML private TabPane tabPane = null;
-
-                private MenuHandler menuHandler = new MenuHandler.Adapter() {
-                    TextInputContentListener textInputTextListener = new TextInputContentListener.Adapter() {
-                        @Override
-                        public void textChanged(TextInput textInput) {
-                            updateActionState(textInput);
-                        }
-                    };
-
-                    TextInputSelectionListener textInputSelectionListener = new TextInputSelectionListener() {
-                        @Override
-                        public void selectionChanged(TextInput textInput, int previousSelectionStart,
-                            int previousSelectionLength) {
-                            updateActionState(textInput);
-                        }
-                    };
-
-                    @Override
-                    public void configureMenuBar(Component component, MenuBar menuBar) {
-                        if (component instanceof TextInput) {
-                            TextInput textInput = (TextInput)component;
-
-                            updateActionState(textInput);
-                            Action.getNamedActions().get("paste").setEnabled(true);
-
-                            textInput.getTextInputContentListeners().add(textInputTextListener);
-                            textInput.getTextInputSelectionListeners().add(textInputSelectionListener);
-                        } else {
-                            Action.getNamedActions().get("cut").setEnabled(false);
-                            Action.getNamedActions().get("copy").setEnabled(false);
-                            Action.getNamedActions().get("paste").setEnabled(false);
-                        }
-                    }
-
-                    @Override
-                    public void cleanupMenuBar(Component component, MenuBar menuBar) {
-                        if (component instanceof TextInput) {
-                            TextInput textInput = (TextInput)component;
-                            textInput.getTextInputContentListeners().remove(textInputTextListener);
-                            textInput.getTextInputSelectionListeners().remove(textInputSelectionListener);
-                        }
-                    }
-
-                    private void updateActionState(TextInput textInput) {
-                        Action.getNamedActions().get("cut").setEnabled(textInput.getSelectionLength() &gt; 0);
-                        Action.getNamedActions().get("copy").setEnabled(textInput.getSelectionLength() &gt; 0);
-                    }
-                };
-
-                public MenuBars() {
-                    Action.getNamedActions().put("fileNew", new Action() {
-                        @Override
-                        public void perform(Component source) {
-                            BXMLSerializer bxmlSerializer = new BXMLSerializer();
-                            bxmlSerializer.getNamespace().put("menuHandler", menuHandler);
-
-                            Component tab;
-                            try {
-                                tab = new Border((Component)bxmlSerializer.readObject(MenuBars.class, "document.bxml"));
-                            } catch (IOException exception) {
-                                throw new RuntimeException(exception);
-                            } catch (SerializationException exception) {
-                                throw new RuntimeException(exception);
-                            }
-
-                            tabPane.getTabs().add(tab);
-                            TabPane.setTabData(tab, "Document " + tabPane.getTabs().getLength());
-                            tabPane.setSelectedIndex(tabPane.getTabs().getLength() - 1);
-                        }
-                    });
-
-                    Action.getNamedActions().put("fileOpen", new Action() {
-                        @Override
-                        public void perform(Component source) {
-                            fileBrowserSheet.open(MenuBars.this);
-                        }
-                    });
-
-                    Action.getNamedActions().put("cut", new Action(false) {
-                        @Override
-                        public void perform(Component source) {
-                            TextInput textInput = (TextInput)MenuBars.this.getFocusDescendant();
-                            textInput.cut();
-                        }
-                    });
-
-                    Action.getNamedActions().put("copy", new Action(false) {
-                        @Override
-                        public void perform(Component source) {
-                            TextInput textInput = (TextInput)MenuBars.this.getFocusDescendant();
-                            textInput.copy();
-                        }
-                    });
-
-                    Action.getNamedActions().put("paste", new Action(false) {
-                        @Override
-                        public void perform(Component source) {
-                            TextInput textInput = (TextInput)MenuBars.this.getFocusDescendant();
-                            textInput.paste();
-                        }
-                    });
-                }
-
-                @Override
-                public void initialize(Map&lt;String, Object&gt; namespace, URL location, Resources resources) {
-                }
-            }
-
-        </pre>
-
-        <p>
-            The class also defines an anonymous inner implementation of the <tt>MenuHandler</tt>
-            interface that is used to configure the menu bar based on the focused component. In
-            <tt>configureMenuBar()</tt>, the actions associated with the "cut", "copy", and "paste"
-            operations are enabled and disabled as appropriate. Listeners are also added to the
-            focused component (if it is a <tt>TextInput</tt>) to ensure that the action's state
-            accurately reflects the current selection. The listeners are removed in
-            <tt>cleanupMenuBar()</tt>, if necessary.
-        </p>
-
-        <p>
-            Note that menu bar configuration via <tt>MenuHandler</tt> isn't limited to enabling or
-            disabling actions - new menu items can be dynamically created, menu item selection
-            state can be changed, etc. However, unlike context menus, the framework does not
-            automatically clean up any changes made to the menu bar. It is up to the application
-            to ensure that the menu bar remains in a consistent state using the
-            <tt>configureMenuBar()</tt> and <tt>cleanupMenuBar()</tt> methods.
-        </p>
-    </div><p>Next: <a href="menu-buttons.html">Menu Buttons</a></p></div></div></div><div class="group" id="footer"><div class="footerLogo">Copyright (c) 1999-2011<br>The Apache Software Foundation.</div><div class="footerLinks"><ul class="footerMenuGr"><li><strong>Demos</strong><ul><li><a href="/demos/kitchen-sink.html" target="_new">"Kitchen Sink"</a></li><li><a href="/demos/component-explorer.html" target="_new">Component Explorer</a></li><li><a href="http://ixnay.biz/pivot-jfree-demos/charts_demo.html" target="_new">Charting</a></li><li><a href="/demos/">More Demos</a></li></ul></li><li><strong>Documentation</strong><ul><li><a href="/getting-started.html">Getting Started</a></li><li><a href="/tutorials/">Tutorial</a></li><li><a href="/faq.html">FAQ</a></li><li><a href="/2.0/docs/api/">Javadoc (2.0)</a></li></ul></li><li><strong>Get Involved</strong><ul><li><a href="/svn.html">SVN Repositories</a></li><li><a href="/lists.html">Mailing Lists</a></li><li><a href="http://iss
 ues.apache.org/jira/browse/PIVOT">Bug Database</a></li><li><a href="http://cwiki.apache.org/PIVOT/">Wiki</a></li></ul></li><li><strong>Related</strong><ul><li><a href="http://code.google.com/p/pivot-jfree/">JFreeChart Provider</a></li></ul></li><li><strong>About</strong><ul><li><a href="/who-we-are.html">Who We Are</a></li><li><a href="/contact.html">Contact</a></li><li><a href="/news.html">News</a></li><li><a href="/legal.html">Legal/License</a></li></ul></li></ul></div></div></div></body></html>
\ No newline at end of file
+--><html xmlns="http://www.w3.org/1999/xhtml"><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Menu Bars | Apache Pivot</title><link href="/styles/pivot.css" rel="stylesheet" type="text/css"><script type="text/javascript">
+                var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
+                document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
+                </script><script type="text/javascript">
+                try {
+                var pageTracker = _gat._getTracker("UA-7977275-3");
+                pageTracker._trackPageview();
+                } catch(err) {}</script></head><body><div id="wrapper"><div id="main"><div id="header"><div xmlns="" class="logo"><a href="/index.html"><img src="/images/logo.png" alt="Apache Pivot" title="Apache Pivot Homepage"></a></div><div class="tagline"><img src="/images/tagline.png" alt="Rich Internet Applications in Java" style="visibility:hidden"></div><ul class="navi"><li><a href="/demos/">Demos</a></li><li><a href="/download.cgi#2.0.1">Download</a></li><li><a href="/tutorials/">Tutorial</a></li><li><a href="/get-involved.html">Get Involved</a></li><li><a href="/about.html">About</a></li></ul></div><div id="contentBase" class="group"><h1>Menu Bars</h1><ul class="naviLeft"><li><a href="/tutorials/sample-application.html">Sample Application</a></li><li><a href="/tutorials/platform-overview.html">Platform Overview</a></li><li><a href="/tutorials/hello-world.html">Hello, World!</a></li><li><a href="/tutorials/hello-bxml.html">Hello, BXML!</a></li><li><a href="/tutorial
 s/component-and-container.html">Component &amp; Container</a></li><li><a href="/tutorials/labels-and-image-views.html">Labels &amp; Image Views</a></li><li><a href="/tutorials/svg-images.html">SVG Images</a></li><li><a href="/tutorials/buttons.html">Buttons</a></li><li><a href="/tutorials/push-buttons.html">Push Buttons</a></li><li><a href="/tutorials/toggle-buttons.html">Toggle Buttons</a></li><li><a href="/tutorials/radio-buttons.html">Radio Buttons</a></li><li><a href="/tutorials/checkboxes.html">Checkboxes</a></li><li><a href="/tutorials/link-buttons.html">Link Buttons</a></li><li><a href="/tutorials/lists.html">Lists</a></li><li><a href="/tutorials/list-buttons.html">List Buttons</a></li><li><a href="/tutorials/repeatable-list-buttons.html">Repeatable List Buttons</a></li><li><a href="/tutorials/text.html">Text</a></li><li><a href="/tutorials/suggestion-popups.html">Suggestion Popups</a></li><li><a href="/tutorials/text-areas.html">Text Areas</a></li><li><a href="/tutor
 ials/separators.html">Separators</a></li><li><a href="/tutorials/layout-containers.html">Layout Containers</a></li><li><a href="/tutorials/flow-panes.html">Flow Panes</a></li><li><a href="/tutorials/box-panes.html">Box Panes</a></li><li><a href="/tutorials/fill-panes.html">Fill Panes</a></li><li><a href="/tutorials/grid-panes.html">Grid Panes</a></li><li><a href="/tutorials/table-panes.html">Table Panes</a></li><li><a href="/tutorials/borders.html">Borders</a></li><li><a href="/tutorials/stack-panes.html">Stack Panes</a></li><li><a href="/tutorials/split-panes.html">Split Panes</a></li><li><a href="/tutorials/forms.html">Forms</a></li><li><a href="/tutorials/panels.html">Panels</a></li><li><a href="/tutorials/navigation-containers.html">Navigation Containers</a></li><li><a href="/tutorials/card-panes.html">Card Panes</a></li><li><a href="/tutorials/tab-panes.html">Tab Panes</a></li><li><a href="/tutorials/accordions.html">Accordions</a></li><li><a href="/tutorials/expanders.
 html">Expanders</a></li><li><a href="/tutorials/rollups.html">Rollups</a></li><li><a href="/tutorials/viewports.html">Viewports</a></li><li><a href="/tutorials/scroll-panes.html">Scroll Panes</a></li><li><a href="/tutorials/panoramas.html">Panoramas</a></li><li><a href="/tutorials/progress-indicators.html">Progress Indicators</a></li><li><a href="/tutorials/meters.html">Meters</a></li><li><a href="/tutorials/activity-indicators.html">Activity Indicators</a></li><li><a href="/tutorials/bounded-range-components.html">Bounded Range Components</a></li><li><a href="/tutorials/sliders.html">Sliders</a></li><li><a href="/tutorials/scroll-bars.html">Scroll Bars</a></li><li><a href="/tutorials/spinners.html">Spinners</a></li><li><a href="/tutorials/calendars.html">Calendars</a></li><li><a href="/tutorials/menus.html">Menus</a></li><li><a href="/tutorials/context-menus.html">Context Menus</a></li><li><a href="/tutorials/menu-bars.html">Menu Bars</a></li><li><a href="/tutorials/menu-bu
 ttons.html">Menu Buttons</a></li><li><a href="/tutorials/color-choosers.html">Color Choosers</a></li><li><a href="/tutorials/table-views.html">Table Views</a></li><li><a href="/tutorials/table-views.json.html">JSON-based TableView</a></li><li><a href="/tutorials/table-views.custom.html">Custom TableView</a></li><li><a href="/tutorials/tree-views.html">Tree Views</a></li><li><a href="/tutorials/file-browsing.html">File Browsing</a></li><li><a href="/tutorials/windows.html">Windows</a></li><li><a href="/tutorials/clipboard.html">Clipboard</a></li><li><a href="/tutorials/drag-and-drop.html">Drag and Drop</a></li><li><a href="/tutorials/effects.html">Effects</a></li><li><a href="/tutorials/effects.transitions.html">Transitions</a></li><li><a href="/tutorials/data-binding.html">Data Binding</a></li><li><a href="/tutorials/property-binding.html">Property Binding</a></li><li><a href="/tutorials/localization.html">Localization</a></li><li><a href="/tutorials/background-tasks.html">B
 ackground Tasks</a></li><li><a href="/tutorials/web-queries.html">Web Queries</a></li><li><a href="/tutorials/query-servlet.html">QueryServlet</a></li><li><a href="/tutorials/scripting.html">Scripting</a></li><li><a href="/tutorials/summary.html">Summary</a></li><li><a href="/tutorials/stock-tracker.html">The "Stock Tracker" Application</a></li><li><a href="/tutorials/stock-tracker.ui.html">UI Markup Using BXML</a></li><li><a href="/tutorials/stock-tracker.events.html">Event Handling</a></li><li><a href="/tutorials/stock-tracker.web-queries.html">Web Queries</a></li><li><a href="/tutorials/stock-tracker.data-binding.html">Data Binding</a></li><li><a href="/tutorials/stock-tracker.localization.html">Localization</a></li><li><a href="/tutorials/bxml-primer.html">BXML Primer</a></li></ul><div class="content"><style type="text/css">
+            applet {
+                border: 1px solid #999999;
+            }
+        </style><!--NOTE: Syntax highlighting script is LGPL--><script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js"></script><script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJava.js"></script><script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushXml.js"></script><script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJScript.js"></script><link type="text/css" rel="stylesheet" href="http://alexgorbatchev.com/pub/sh/current/styles/shCore.css"><link type="text/css" rel="stylesheet" href="http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css"><script type="text/javascript">
+            SyntaxHighlighter.all();
+        </script><div class="section">
+        <p>
+            Menu bars are generally used to provide convenient access to major application
+            features. They act as a repository for top-level hierarchical menus, keeping the menus
+            out of sight until they are needed.
+        </p>
+
+        <p>
+            Like all other components, menu bars can actually be placed anywhere in an
+            application's user interface. However, they are most often located at the top of an
+            application's main window. Pivot provides framework-level support for simplifying the
+            task of defining a menu bar positioned in this way. The <tt>Frame</tt> class defines
+            a "menuBar" property that is handled specially by the application using the
+            <tt>configureMenuBar()</tt> and <tt>cleanupMenuBar()</tt> methods of the
+            <tt>MenuHandler</tt> interface. These methods are called by the framework as the focus
+            changes within a window, to allow the application to customize the contents of the menu
+            bar based on the currently focused component.
+        </p>
+
+        <p>
+            The example application below shows a menu bar containing two common top-level menu
+            items: "File" and "Edit" (note that the applet is signed since it makes use of the
+            <tt>FileBrowserSheet</tt> component, which requires access to the local file system):
+        </p>
+
+        <script type="text/javascript" src="http://java.com/js/deployJava.js"></script><script type="text/javascript">
+            
+            var attributes = {
+                code:"org.apache.pivot.wtk.BrowserApplicationContext$HostApplet",
+                width:"640",
+                height:"480"
+            };
+
+            
+            
+
+            
+            var libraries = [];
+            libraries.push("/lib/pivot-core-2.0.1.signed.jar");
+                libraries.push("/lib/pivot-wtk-2.0.1.signed.jar");
+                libraries.push("/lib/pivot-wtk-terra-2.0.1.signed.jar");
+                libraries.push("/lib/pivot-tutorials-2.0.1.signed.jar");
+                
+                    libraries.push("/lib/svgSalamander-tiny.signed.jar");
+                
+
+            attributes.archive = libraries.join(",");
+
+            
+            var parameters = {
+                codebase_lookup:false,
+                application_class_name:'org.apache.pivot.wtk.ScriptApplication'
+            };
+
+            
+            var javaArguments = ["-Dsun.awt.noerasebackground=true",
+                "-Dsun.awt.erasebackgroundonresize=true"];
+
+            
+
+            parameters.java_arguments = javaArguments.join(" ");
+
+            
+            
+                var startupProperties = [];
+                
+                    startupProperties.push("src=/org/apache/pivot/tutorials/menus/menu_bars.bxml");
+                
+                parameters.startup_properties = startupProperties.join("&");
+            
+
+            deployJava.runApplet(attributes, parameters, "1.6");
+        </script>
+
+        <p>
+            Each sub-menu item is associated with an <tt>Action</tt> that is executed when the
+            item is selected. For example, the action attached to the "File &gt; Open" menu item
+            simulates opening a document by showing a file browser sheet and adding a new tab to
+            the application's tab pane. Each component in the "document" has a menu handler
+            attached to it that configures the menu contents as appropriate for the current
+            selection. When a text input component has the focus, the "Paste" menu item is enabled.
+            If text is selected in the text input, the "Cut" and "Copy" menu items are also
+            enabled.
+        </p>
+
+        <p>
+            The BXML source for this example is shown below. It creates the initial menu structure
+            as well as the tab pane that will host the simulated documents. It also defines a set
+            of "action mappings" in the root frame's "actionMappings" sequence. Action mappings
+            associate keystrokes with actions; when a keystroke matching an action in the sequence
+            is processed by the window, the action is invoked. Action mappings are often called
+            "keyboard shortcuts".
+        </p>
+
+        <p>
+            Note that the actions in this example are associated with the "CMD" key. This is a
+            Pivot-specific, platform-independent modifier. It maps to the Control key (CTRL)
+            on Windows and Linux and the Command key (META) on Mac OS X:
+        </p>
+
+        <pre class="brush:xml">
+            
+            &lt;menus:MenuBars title="Menu Bars" maximized="true"
+                styles="{padding:{top:0, left:4, bottom:4, right:4}, showWindowControls:false}"
+                xmlns:bxml="http://pivot.apache.org/bxml"
+                xmlns:content="org.apache.pivot.wtk.content"
+                xmlns:menus="org.apache.pivot.tutorials.menus"
+                xmlns="org.apache.pivot.wtk"&gt;
+                &lt;bxml:define&gt;
+                    &lt;FileBrowserSheet bxml:id="fileBrowserSheet"/&gt;
+                &lt;/bxml:define&gt;
+
+                &lt;actionMappings&gt;
+                    &lt;Window.ActionMapping action="fileNew" keyStroke="CMD-N"/&gt;
+                    &lt;Window.ActionMapping action="fileOpen" keyStroke="CMD-O"/&gt;
+                &lt;/actionMappings&gt;
+
+                &lt;menuBar&gt;
+                    &lt;MenuBar&gt;
+                        &lt;MenuBar.Item buttonData="File"&gt;
+                            &lt;Menu&gt;
+                                &lt;Menu.Section&gt;
+                                    &lt;Menu.Item action="fileNew"&gt;
+                                        &lt;buttonData&gt;
+                                            &lt;content:MenuItemData text="New" keyboardShortcut="CMD-N"/&gt;
+                                        &lt;/buttonData&gt;
+                                    &lt;/Menu.Item&gt;
+
+                                    &lt;Menu.Item action="fileOpen"&gt;
+                                        &lt;buttonData&gt;
+                                            &lt;content:MenuItemData text="Open" keyboardShortcut="CMD-O"/&gt;
+                                        &lt;/buttonData&gt;
+                                    &lt;/Menu.Item&gt;
+                                &lt;/Menu.Section&gt;
+                            &lt;/Menu&gt;
+                        &lt;/MenuBar.Item&gt;
+
+                        &lt;MenuBar.Item buttonData="Edit"&gt;
+                            &lt;Menu&gt;
+                                &lt;Menu.Section&gt;
+                                    &lt;Menu.Item action="cut"&gt;
+                                        &lt;buttonData&gt;
+                                            &lt;content:MenuItemData text="Cut" keyboardShortcut="CMD-X"/&gt;
+                                        &lt;/buttonData&gt;
+                                    &lt;/Menu.Item&gt;
+                                    &lt;Menu.Item action="copy"&gt;
+                                        &lt;buttonData&gt;
+                                            &lt;content:MenuItemData text="Copy" keyboardShortcut="CMD-C"/&gt;
+                                        &lt;/buttonData&gt;
+                                    &lt;/Menu.Item&gt;
+                                    &lt;Menu.Item action="paste"&gt;
+                                        &lt;buttonData&gt;
+                                            &lt;content:MenuItemData text="Paste" keyboardShortcut="CMD-V"/&gt;
+                                        &lt;/buttonData&gt;
+                                    &lt;/Menu.Item&gt;
+                                &lt;/Menu.Section&gt;
+                            &lt;/Menu&gt;
+                        &lt;/MenuBar.Item&gt;
+                    &lt;/MenuBar&gt;
+                &lt;/menuBar&gt;
+
+                &lt;Border styles="{backgroundColor:null, padding:2}"&gt;
+                    &lt;TabPane bxml:id="tabPane"/&gt;
+                &lt;/Border&gt;
+            &lt;/menus:MenuBars&gt;
+            
+        </pre>
+
+        <p>
+            The Java source for the example is shown below. In the constructor, the application's
+            actions are created and added to the global action dictionary. Note that, since the
+            BXML file refers to the actions by ID, it is essential that the actions be available
+            before the BXML is read.
+        </p>
+
+        <pre class="brush:java">
+            
+            package org.apache.pivot.tutorials.menus;
+
+            import java.io.IOException;
+            import java.net.URL;
+
+            import org.apache.pivot.beans.BXML;
+            import org.apache.pivot.beans.BXMLSerializer;
+            import org.apache.pivot.beans.Bindable;
+            import org.apache.pivot.collections.Map;
+            import org.apache.pivot.serialization.SerializationException;
+            import org.apache.pivot.util.Resources;
+            import org.apache.pivot.wtk.Action;
+            import org.apache.pivot.wtk.Border;
+            import org.apache.pivot.wtk.Component;
+            import org.apache.pivot.wtk.FileBrowserSheet;
+            import org.apache.pivot.wtk.Frame;
+            import org.apache.pivot.wtk.MenuBar;
+            import org.apache.pivot.wtk.MenuHandler;
+            import org.apache.pivot.wtk.TabPane;
+            import org.apache.pivot.wtk.TextInput;
+            import org.apache.pivot.wtk.TextInputSelectionListener;
+            import org.apache.pivot.wtk.TextInputContentListener;
+
+            public class MenuBars extends Frame implements Bindable {
+                @BXML private FileBrowserSheet fileBrowserSheet;
+                @BXML private TabPane tabPane = null;
+
+                private MenuHandler menuHandler = new MenuHandler.Adapter() {
+                    TextInputContentListener textInputTextListener = new TextInputContentListener.Adapter() {
+                        @Override
+                        public void textChanged(TextInput textInput) {
+                            updateActionState(textInput);
+                        }
+                    };
+
+                    TextInputSelectionListener textInputSelectionListener = new TextInputSelectionListener() {
+                        @Override
+                        public void selectionChanged(TextInput textInput, int previousSelectionStart,
+                            int previousSelectionLength) {
+                            updateActionState(textInput);
+                        }
+                    };
+
+                    @Override
+                    public void configureMenuBar(Component component, MenuBar menuBar) {
+                        if (component instanceof TextInput) {
+                            TextInput textInput = (TextInput)component;
+
+                            updateActionState(textInput);
+                            Action.getNamedActions().get("paste").setEnabled(true);
+
+                            textInput.getTextInputContentListeners().add(textInputTextListener);
+                            textInput.getTextInputSelectionListeners().add(textInputSelectionListener);
+                        } else {
+                            Action.getNamedActions().get("cut").setEnabled(false);
+                            Action.getNamedActions().get("copy").setEnabled(false);
+                            Action.getNamedActions().get("paste").setEnabled(false);
+                        }
+                    }
+
+                    @Override
+                    public void cleanupMenuBar(Component component, MenuBar menuBar) {
+                        if (component instanceof TextInput) {
+                            TextInput textInput = (TextInput)component;
+                            textInput.getTextInputContentListeners().remove(textInputTextListener);
+                            textInput.getTextInputSelectionListeners().remove(textInputSelectionListener);
+                        }
+                    }
+
+                    private void updateActionState(TextInput textInput) {
+                        Action.getNamedActions().get("cut").setEnabled(textInput.getSelectionLength() &gt; 0);
+                        Action.getNamedActions().get("copy").setEnabled(textInput.getSelectionLength() &gt; 0);
+                    }
+                };
+
+                public MenuBars() {
+                    Action.getNamedActions().put("fileNew", new Action() {
+                        @Override
+                        public void perform(Component source) {
+                            BXMLSerializer bxmlSerializer = new BXMLSerializer();
+                            bxmlSerializer.getNamespace().put("menuHandler", menuHandler);
+
+                            Component tab;
+                            try {
+                                tab = new Border((Component)bxmlSerializer.readObject(MenuBars.class, "document.bxml"));
+                            } catch (IOException exception) {
+                                throw new RuntimeException(exception);
+                            } catch (SerializationException exception) {
+                                throw new RuntimeException(exception);
+                            }
+
+                            tabPane.getTabs().add(tab);
+                            TabPane.setTabData(tab, "Document " + tabPane.getTabs().getLength());
+                            tabPane.setSelectedIndex(tabPane.getTabs().getLength() - 1);
+                        }
+                    });
+
+                    Action.getNamedActions().put("fileOpen", new Action() {
+                        @Override
+                        public void perform(Component source) {
+                            fileBrowserSheet.open(MenuBars.this);
+                        }
+                    });
+
+                    Action.getNamedActions().put("cut", new Action(false) {
+                        @Override
+                        public void perform(Component source) {
+                            TextInput textInput = (TextInput)MenuBars.this.getFocusDescendant();
+                            textInput.cut();
+                        }
+                    });
+
+                    Action.getNamedActions().put("copy", new Action(false) {
+                        @Override
+                        public void perform(Component source) {
+                            TextInput textInput = (TextInput)MenuBars.this.getFocusDescendant();
+                            textInput.copy();
+                        }
+                    });
+
+                    Action.getNamedActions().put("paste", new Action(false) {
+                        @Override
+                        public void perform(Component source) {
+                            TextInput textInput = (TextInput)MenuBars.this.getFocusDescendant();
+                            textInput.paste();
+                        }
+                    });
+                }
+
+                @Override
+                public void initialize(Map&lt;String, Object&gt; namespace, URL location, Resources resources) {
+                }
+            }
+            
+        </pre>
+
+        <p>
+            The class also defines an anonymous inner implementation of the <tt>MenuHandler</tt>
+            interface that is used to configure the menu bar based on the focused component. In
+            <tt>configureMenuBar()</tt>, the actions associated with the "cut", "copy", and "paste"
+            operations are enabled and disabled as appropriate. Listeners are also added to the
+            focused component (if it is a <tt>TextInput</tt>) to ensure that the action's state
+            accurately reflects the current selection. The listeners are removed in
+            <tt>cleanupMenuBar()</tt>, if necessary.
+        </p>
+
+        <p>
+            Note that menu bar configuration via <tt>MenuHandler</tt> isn't limited to enabling or
+            disabling actions - new menu items can be dynamically created, menu item selection
+            state can be changed, etc. However, unlike context menus, the framework does not
+            automatically clean up any changes made to the menu bar. It is up to the application
+            to ensure that the menu bar remains in a consistent state using the
+            <tt>configureMenuBar()</tt> and <tt>cleanupMenuBar()</tt> methods.
+        </p>
+    </div><p>Next: <a href="menu-buttons.html">Menu Buttons</a></p></div></div></div><div id="footer" class="group"><div class="footerLogo">Copyright (c) 1999-2012<br>The Apache Software Foundation.</div><div class="footerLinks"><ul class="footerMenuGr"><li><strong>Demos</strong><ul><li><a href="/demos/kitchen-sink.html" target="_new">"Kitchen Sink"</a></li><li><a href="/demos/component-explorer.html" target="_new">Component Explorer</a></li><li><a href="http://cwiki.apache.org/confluence/display/PIVOT/Other+Demos" target="_new">Charting</a></li><li><a href="/demos/">More Demos</a></li></ul></li><li><strong>Documentation</strong><ul><li><a href="/getting-started.html">Getting Started</a></li><li><a href="/tutorials/">Tutorial</a></li><li><a href="/faq.html">FAQ</a></li><li><a href="/2.0.1/docs/api/">Javadoc (2.0.1)</a></li></ul></li><li><strong>Get Involved</strong><ul><li><a href="/svn.html">SVN Repositories</a></li><li><a href="/lists.html">Mailing Lists</a></li><li><a hre
 f="http://issues.apache.org/jira/browse/PIVOT">Bug Database</a></li><li><a href="http://cwiki.apache.org/PIVOT/">Wiki</a></li></ul></li><li><strong>Related</strong><ul><li><a href="http://code.google.com/a/apache-extras.org/p/pivot-jfree/">JFreeChart Provider</a></li><li><a href="http://code.google.com/a/apache-extras.org/p/pivot-common/">Pivot-Common</a></li><li><a href="http://code.google.com/a/apache-extras.org/p/pivot-contrib/">Pivot-Contrib</a></li><li><a href="http://code.google.com/a/apache-extras.org/p/pivot-multilang/">Pivot-Multilang</a></li></ul></li><li><strong>About</strong><ul><li><a href="/who-we-are.html">Who We Are</a></li><li><a href="/contact.html">Contact</a></li><li><a href="http://cwiki.apache.org/confluence/display/PIVOT/News">News</a></li><li><a href="/legal.html">Legal/License</a></li></ul></li></ul></div><div class="footerLinks">
+                	Apache Pivot is a trademark of the Apache Software Foundation
+                </div></div></div></body></html>
\ No newline at end of file

Modified: pivot/site/trunk/deploy/tutorials/menu-buttons.html
URL: http://svn.apache.org/viewvc/pivot/site/trunk/deploy/tutorials/menu-buttons.html?rev=1233143&r1=1233142&r2=1233143&view=diff
==============================================================================
--- pivot/site/trunk/deploy/tutorials/menu-buttons.html (original)
+++ pivot/site/trunk/deploy/tutorials/menu-buttons.html Thu Jan 19 00:51:39 2012
@@ -1,4 +1,4 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <!--
 Licensed to the Apache Software Foundation (ASF) under one or more
 contributor license agreements.  See the NOTICE file distributed with
@@ -14,179 +14,181 @@ distributed under the License is distrib
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
---><html xmlns="http://www.w3.org/1999/xhtml"><head><meta content="text/html; charset=UTF-8" http-equiv="Content-Type" /><title>Menu Buttons | Apache Pivot</title><link xmlns="" type="text/css" rel="stylesheet" href="/styles/pivot.css"><script xmlns="http://www.w3.org/1999/xhtml" type="text/javascript">
-                var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
-                document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
-                </script><script type="text/javascript">
-                try {
-                var pageTracker = _gat._getTracker("UA-7977275-3");
-                pageTracker._trackPageview();
-                } catch(err) {}</script></head><body><div xmlns="" id="wrapper"><div id="main"><div id="header"><div class="logo"><a href="/index.html"><img title="Apache Pivot Homepage" alt="Apache Pivot" src="/images/logo.png"></a></div><div class="tagline"><img style="visibility:hidden" alt="Rich Internet Applications in Java" src="/images/tagline.png"></div><ul class="navi"><li><a href="/demos/">Demos</a></li><li><a href="/download.cgi#2.0">Download</a></li><li><a href="/tutorials/">Tutorial</a></li><li><a href="/get-involved.html">Get Involved</a></li><li><a href="/about.html">About</a></li></ul></div><div class="group" id="contentBase"><h1>Menu Buttons</h1><ul class="naviLeft"><li><a href="/tutorials/sample-application.html">Sample Application</a></li><li><a href="/tutorials/platform-overview.html">Platform Overview</a></li><li><a href="/tutorials/hello-world.html">Hello, World!</a></li><li><a href="/tutorials/hello-bxml.html">Hello, BXML!</a></li><li><a href="/tutoria
 ls/component-and-container.html">Component &amp; Container</a></li><li><a href="/tutorials/labels-and-image-views.html">Labels &amp; Image Views</a></li><li><a href="/tutorials/svg-images.html">SVG Images</a></li><li><a href="/tutorials/buttons.html">Buttons</a></li><li><a href="/tutorials/push-buttons.html">Push Buttons</a></li><li><a href="/tutorials/toggle-buttons.html">Toggle Buttons</a></li><li><a href="/tutorials/radio-buttons.html">Radio Buttons</a></li><li><a href="/tutorials/checkboxes.html">Checkboxes</a></li><li><a href="/tutorials/link-buttons.html">Link Buttons</a></li><li><a href="/tutorials/lists.html">Lists</a></li><li><a href="/tutorials/list-buttons.html">List Buttons</a></li><li><a href="/tutorials/repeatable-list-buttons.html">Repeatable List Buttons</a></li><li><a href="/tutorials/text.html">Text</a></li><li><a href="/tutorials/suggestion-popups.html">Suggestion Popups</a></li><li><a href="/tutorials/text-areas.html">Text Areas</a></li><li><a href="/tuto
 rials/separators.html">Separators</a></li><li><a href="/tutorials/layout-containers.html">Layout Containers</a></li><li><a href="/tutorials/flow-panes.html">Flow Panes</a></li><li><a href="/tutorials/box-panes.html">Box Panes</a></li><li><a href="/tutorials/grid-panes.html">Grid Panes</a></li><li><a href="/tutorials/table-panes.html">Table Panes</a></li><li><a href="/tutorials/borders.html">Borders</a></li><li><a href="/tutorials/stack-panes.html">Stack Panes</a></li><li><a href="/tutorials/split-panes.html">Split Panes</a></li><li><a href="/tutorials/forms.html">Forms</a></li><li><a href="/tutorials/panels.html">Panels</a></li><li><a href="/tutorials/navigation-containers.html">Navigation Containers</a></li><li><a href="/tutorials/card-panes.html">Card Panes</a></li><li><a href="/tutorials/tab-panes.html">Tab Panes</a></li><li><a href="/tutorials/accordions.html">Accordions</a></li><li><a href="/tutorials/expanders.html">Expanders</a></li><li><a href="/tutorials/rollups.htm
 l">Rollups</a></li><li><a href="/tutorials/viewports.html">Viewports</a></li><li><a href="/tutorials/scroll-panes.html">Scroll Panes</a></li><li><a href="/tutorials/panoramas.html">Panoramas</a></li><li><a href="/tutorials/progress-indicators.html">Progress Indicators</a></li><li><a href="/tutorials/meters.html">Meters</a></li><li><a href="/tutorials/activity-indicators.html">Activity Indicators</a></li><li><a href="/tutorials/bounded-range-components.html">Bounded Range Components</a></li><li><a href="/tutorials/sliders.html">Sliders</a></li><li><a href="/tutorials/scroll-bars.html">Scroll Bars</a></li><li><a href="/tutorials/spinners.html">Spinners</a></li><li><a href="/tutorials/calendars.html">Calendars</a></li><li><a href="/tutorials/menus.html">Menus</a></li><li><a href="/tutorials/context-menus.html">Context Menus</a></li><li><a href="/tutorials/menu-bars.html">Menu Bars</a></li><li><a href="/tutorials/menu-buttons.html">Menu Buttons</a></li><li><a href="/tutorials/co
 lor-choosers.html">Color Choosers</a></li><li><a href="/tutorials/table-views.html">Table Views</a></li><li><a href="/tutorials/table-views.json.html">JSON-based TableView</a></li><li><a href="/tutorials/table-views.custom.html">Custom TableView</a></li><li><a href="/tutorials/tree-views.html">Tree Views</a></li><li><a href="/tutorials/file-browsing.html">File Browsing</a></li><li><a href="/tutorials/windows.html">Windows</a></li><li><a href="/tutorials/clipboard.html">Clipboard</a></li><li><a href="/tutorials/drag-and-drop.html">Drag and Drop</a></li><li><a href="/tutorials/effects.html">Effects</a></li><li><a href="/tutorials/effects.transitions.html">Transitions</a></li><li><a href="/tutorials/data-binding.html">Data Binding</a></li><li><a href="/tutorials/property-binding.html">Property Binding</a></li><li><a href="/tutorials/localization.html">Localization</a></li><li><a href="/tutorials/background-tasks.html">Background Tasks</a></li><li><a href="/tutorials/web-queries
 .html">Web Queries</a></li><li><a href="/tutorials/query-servlet.html">QueryServlet</a></li><li><a href="/tutorials/scripting.html">Scripting</a></li><li><a href="/tutorials/summary.html">Summary</a></li><li><a href="/tutorials/stock-tracker.html">The "Stock Tracker" Application</a></li><li><a href="/tutorials/stock-tracker.ui.html">UI Markup Using BXML</a></li><li><a href="/tutorials/stock-tracker.events.html">Event Handling</a></li><li><a href="/tutorials/stock-tracker.web-queries.html">Web Queries</a></li><li><a href="/tutorials/stock-tracker.data-binding.html">Data Binding</a></li><li><a href="/tutorials/stock-tracker.localization.html">Localization</a></li><li><a href="/tutorials/bxml-primer.html">BXML Primer</a></li></ul><div class="content"><style type="text/css">
-            applet {
-                border: 1px solid #999999;
-            }
-        </style><!--NOTE: Syntax highlighting script is LGPL--><script src="http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js" type="text/javascript"></script><script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJava.js" type="text/javascript"></script><script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushXml.js" type="text/javascript"></script><script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJScript.js" type="text/javascript"></script><link href="http://alexgorbatchev.com/pub/sh/current/styles/shCore.css" rel="stylesheet" type="text/css"><link href="http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css" rel="stylesheet" type="text/css"><script type="text/javascript">
-            SyntaxHighlighter.all();
-        </script><div class="section">
-        <p>
-            Menu buttons are similar to <a href="list-buttons.html">list buttons</a>, but provide
-            access to "drop-down" menus rather than list views. They are often used in toolbars,
-            but can be placed anywhere within an application's user interface.
-        </p>
-
-        <p>
-            The following sample application demonstrates the use of a menu button. Selecting an
-            option from the menu button on the left adds the corresponding component type to the
-            content area on the right:
-        </p>
-
-        <script src="http://java.com/js/deployJava.js" type="text/javascript"></script><script type="text/javascript">
-
-            var attributes = {
-                code:"org.apache.pivot.wtk.BrowserApplicationContext$HostApplet",
-                width:"360",
-                height:"240"
-            };
-
-
-
-
-
-            var libraries = [];
-            libraries.push("/lib/pivot-core-2.0.jar");
-                libraries.push("/lib/pivot-wtk-2.0.jar");
-                libraries.push("/lib/pivot-wtk-terra-2.0.jar");
-                libraries.push("/lib/pivot-tutorials-2.0.jar");
-
-                    libraries.push("/lib/svgSalamander-tiny.jar");
-
-
-            attributes.archive = libraries.join(",");
-
-
-            var parameters = {
-                codebase_lookup:false,
-                application_class_name:'org.apache.pivot.wtk.ScriptApplication'
-            };
-
-
-            var javaArguments = ["-Dsun.awt.noerasebackground=true",
-                "-Dsun.awt.erasebackgroundonresize=true"];
-
-
-
-            parameters.java_arguments = javaArguments.join(" ");
-
-
-
-                var startupProperties = [];
-
-                    startupProperties.push("src=/org/apache/pivot/tutorials/menus/menu_buttons.bxml");
-
-                parameters.startup_properties = startupProperties.join("&");
-
-
-            deployJava.runApplet(attributes, parameters, "1.6");
-        </script>
-
-        <p>
-            The BXML source for the application is as follows:
-        </p>
-
-        <pre class="brush:xml">
-
-            &lt;menus:MenuButtons title="Menu Buttons" maximized="true"
-                xmlns:bxml="http://pivot.apache.org/bxml"
-                xmlns:content="org.apache.pivot.wtk.content"
-                xmlns:menus="org.apache.pivot.tutorials.menus"
-                xmlns="org.apache.pivot.wtk"&gt;
-                &lt;Border styles="{padding:8}"&gt;
-                    &lt;TablePane styles="{horizontalSpacing:4}"&gt;
-                        &lt;columns&gt;
-                            &lt;TablePane.Column width="-1"/&gt;
-                            &lt;TablePane.Column width="1*"/&gt;
-                        &lt;/columns&gt;
-
-                        &lt;TablePane.Row height="1*"&gt;
-                            &lt;BoxPane orientation="vertical"&gt;
-                                &lt;MenuButton buttonData="Add Component"&gt;
-                                    &lt;Menu&gt;
-                                        &lt;Menu.Section&gt;
-                                            &lt;Menu.Item buttonData="Push Button" action="addPushButton"/&gt;
-                                            &lt;Menu.Item buttonData="Checkbox" action="addCheckbox"/&gt;
-                                            &lt;Menu.Item buttonData="Radio Button" action="addRadioButton"/&gt;
-                                        &lt;/Menu.Section&gt;
-                                    &lt;/Menu&gt;
-                                &lt;/MenuButton&gt;
-                            &lt;/BoxPane&gt;
-
-                            &lt;Border&gt;
-                                &lt;ScrollPane&gt;
-                                    &lt;BoxPane bxml:id="componentBoxPane" orientation="vertical"
-                                        styles="{padding:4, spacing:4}"/&gt;
-                                &lt;/ScrollPane&gt;
-                            &lt;/Border&gt;
-                        &lt;/TablePane.Row&gt;
-                    &lt;/TablePane&gt;
-                &lt;/Border&gt;
-            &lt;/menus:MenuButtons&gt;
-
-        </pre>
-
-        <p>
-            Like the previous example, it defines a set of menu items that are associated with
-            named actions. The Java source, which defines the actions, is shown below:
-        </p>
-
-        <pre class="brush:java">
-
-            package org.apache.pivot.tutorials.menus;
-
-            import java.net.URL;
-
-            import org.apache.pivot.beans.Bindable;
-            import org.apache.pivot.collections.Map;
-            import org.apache.pivot.util.Resources;
-            import org.apache.pivot.wtk.Action;
-            import org.apache.pivot.wtk.BoxPane;
-            import org.apache.pivot.wtk.Checkbox;
-            import org.apache.pivot.wtk.Component;
-            import org.apache.pivot.wtk.PushButton;
-            import org.apache.pivot.wtk.RadioButton;
-            import org.apache.pivot.wtk.Window;
-
-            public class MenuButtons extends Window implements Bindable {
-                private BoxPane componentBoxPane = null;
-
-                public MenuButtons() {
-                    Action.getNamedActions().put("addPushButton", new Action() {
-                        @Override
-                        public void perform(Component source) {
-                            componentBoxPane.add(new PushButton("Push button"));
-
-                        }
-                    });
-
-                    Action.getNamedActions().put("addCheckbox", new Action() {
-                        @Override
-                        public void perform(Component source) {
-                            componentBoxPane.add(new Checkbox("Checkbox"));
-                        }
-                    });
-
-                    Action.getNamedActions().put("addRadioButton", new Action() {
-                        @Override
-                        public void perform(Component source) {
-                            componentBoxPane.add(new RadioButton("Radio button"));
-                        }
-                    });
-                }
-
-                @Override
-                public void initialize(Map&lt;String, Object&gt; namespace, URL location, Resources resources) {
-                    componentBoxPane = (BoxPane)namespace.get("componentBoxPane");
-                }
-            }
-
-        </pre>
-    </div><p>Next: <a href="color-choosers.html">Color Choosers</a></p></div></div></div><div class="group" id="footer"><div class="footerLogo">Copyright (c) 1999-2011<br>The Apache Software Foundation.</div><div class="footerLinks"><ul class="footerMenuGr"><li><strong>Demos</strong><ul><li><a href="/demos/kitchen-sink.html" target="_new">"Kitchen Sink"</a></li><li><a href="/demos/component-explorer.html" target="_new">Component Explorer</a></li><li><a href="http://ixnay.biz/pivot-jfree-demos/charts_demo.html" target="_new">Charting</a></li><li><a href="/demos/">More Demos</a></li></ul></li><li><strong>Documentation</strong><ul><li><a href="/getting-started.html">Getting Started</a></li><li><a href="/tutorials/">Tutorial</a></li><li><a href="/faq.html">FAQ</a></li><li><a href="/2.0/docs/api/">Javadoc (2.0)</a></li></ul></li><li><strong>Get Involved</strong><ul><li><a href="/svn.html">SVN Repositories</a></li><li><a href="/lists.html">Mailing Lists</a></li><li><a href="http:/
 /issues.apache.org/jira/browse/PIVOT">Bug Database</a></li><li><a href="http://cwiki.apache.org/PIVOT/">Wiki</a></li></ul></li><li><strong>Related</strong><ul><li><a href="http://code.google.com/p/pivot-jfree/">JFreeChart Provider</a></li></ul></li><li><strong>About</strong><ul><li><a href="/who-we-are.html">Who We Are</a></li><li><a href="/contact.html">Contact</a></li><li><a href="/news.html">News</a></li><li><a href="/legal.html">Legal/License</a></li></ul></li></ul></div></div></div></body></html>
\ No newline at end of file
+--><html xmlns="http://www.w3.org/1999/xhtml"><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Menu Buttons | Apache Pivot</title><link href="/styles/pivot.css" rel="stylesheet" type="text/css"><script type="text/javascript">
+                var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
+                document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
+                </script><script type="text/javascript">
+                try {
+                var pageTracker = _gat._getTracker("UA-7977275-3");
+                pageTracker._trackPageview();
+                } catch(err) {}</script></head><body><div id="wrapper"><div id="main"><div id="header"><div xmlns="" class="logo"><a href="/index.html"><img src="/images/logo.png" alt="Apache Pivot" title="Apache Pivot Homepage"></a></div><div class="tagline"><img src="/images/tagline.png" alt="Rich Internet Applications in Java" style="visibility:hidden"></div><ul class="navi"><li><a href="/demos/">Demos</a></li><li><a href="/download.cgi#2.0.1">Download</a></li><li><a href="/tutorials/">Tutorial</a></li><li><a href="/get-involved.html">Get Involved</a></li><li><a href="/about.html">About</a></li></ul></div><div id="contentBase" class="group"><h1>Menu Buttons</h1><ul class="naviLeft"><li><a href="/tutorials/sample-application.html">Sample Application</a></li><li><a href="/tutorials/platform-overview.html">Platform Overview</a></li><li><a href="/tutorials/hello-world.html">Hello, World!</a></li><li><a href="/tutorials/hello-bxml.html">Hello, BXML!</a></li><li><a href="/tutor
 ials/component-and-container.html">Component &amp; Container</a></li><li><a href="/tutorials/labels-and-image-views.html">Labels &amp; Image Views</a></li><li><a href="/tutorials/svg-images.html">SVG Images</a></li><li><a href="/tutorials/buttons.html">Buttons</a></li><li><a href="/tutorials/push-buttons.html">Push Buttons</a></li><li><a href="/tutorials/toggle-buttons.html">Toggle Buttons</a></li><li><a href="/tutorials/radio-buttons.html">Radio Buttons</a></li><li><a href="/tutorials/checkboxes.html">Checkboxes</a></li><li><a href="/tutorials/link-buttons.html">Link Buttons</a></li><li><a href="/tutorials/lists.html">Lists</a></li><li><a href="/tutorials/list-buttons.html">List Buttons</a></li><li><a href="/tutorials/repeatable-list-buttons.html">Repeatable List Buttons</a></li><li><a href="/tutorials/text.html">Text</a></li><li><a href="/tutorials/suggestion-popups.html">Suggestion Popups</a></li><li><a href="/tutorials/text-areas.html">Text Areas</a></li><li><a href="/tu
 torials/separators.html">Separators</a></li><li><a href="/tutorials/layout-containers.html">Layout Containers</a></li><li><a href="/tutorials/flow-panes.html">Flow Panes</a></li><li><a href="/tutorials/box-panes.html">Box Panes</a></li><li><a href="/tutorials/fill-panes.html">Fill Panes</a></li><li><a href="/tutorials/grid-panes.html">Grid Panes</a></li><li><a href="/tutorials/table-panes.html">Table Panes</a></li><li><a href="/tutorials/borders.html">Borders</a></li><li><a href="/tutorials/stack-panes.html">Stack Panes</a></li><li><a href="/tutorials/split-panes.html">Split Panes</a></li><li><a href="/tutorials/forms.html">Forms</a></li><li><a href="/tutorials/panels.html">Panels</a></li><li><a href="/tutorials/navigation-containers.html">Navigation Containers</a></li><li><a href="/tutorials/card-panes.html">Card Panes</a></li><li><a href="/tutorials/tab-panes.html">Tab Panes</a></li><li><a href="/tutorials/accordions.html">Accordions</a></li><li><a href="/tutorials/expande
 rs.html">Expanders</a></li><li><a href="/tutorials/rollups.html">Rollups</a></li><li><a href="/tutorials/viewports.html">Viewports</a></li><li><a href="/tutorials/scroll-panes.html">Scroll Panes</a></li><li><a href="/tutorials/panoramas.html">Panoramas</a></li><li><a href="/tutorials/progress-indicators.html">Progress Indicators</a></li><li><a href="/tutorials/meters.html">Meters</a></li><li><a href="/tutorials/activity-indicators.html">Activity Indicators</a></li><li><a href="/tutorials/bounded-range-components.html">Bounded Range Components</a></li><li><a href="/tutorials/sliders.html">Sliders</a></li><li><a href="/tutorials/scroll-bars.html">Scroll Bars</a></li><li><a href="/tutorials/spinners.html">Spinners</a></li><li><a href="/tutorials/calendars.html">Calendars</a></li><li><a href="/tutorials/menus.html">Menus</a></li><li><a href="/tutorials/context-menus.html">Context Menus</a></li><li><a href="/tutorials/menu-bars.html">Menu Bars</a></li><li><a href="/tutorials/menu
 -buttons.html">Menu Buttons</a></li><li><a href="/tutorials/color-choosers.html">Color Choosers</a></li><li><a href="/tutorials/table-views.html">Table Views</a></li><li><a href="/tutorials/table-views.json.html">JSON-based TableView</a></li><li><a href="/tutorials/table-views.custom.html">Custom TableView</a></li><li><a href="/tutorials/tree-views.html">Tree Views</a></li><li><a href="/tutorials/file-browsing.html">File Browsing</a></li><li><a href="/tutorials/windows.html">Windows</a></li><li><a href="/tutorials/clipboard.html">Clipboard</a></li><li><a href="/tutorials/drag-and-drop.html">Drag and Drop</a></li><li><a href="/tutorials/effects.html">Effects</a></li><li><a href="/tutorials/effects.transitions.html">Transitions</a></li><li><a href="/tutorials/data-binding.html">Data Binding</a></li><li><a href="/tutorials/property-binding.html">Property Binding</a></li><li><a href="/tutorials/localization.html">Localization</a></li><li><a href="/tutorials/background-tasks.html
 ">Background Tasks</a></li><li><a href="/tutorials/web-queries.html">Web Queries</a></li><li><a href="/tutorials/query-servlet.html">QueryServlet</a></li><li><a href="/tutorials/scripting.html">Scripting</a></li><li><a href="/tutorials/summary.html">Summary</a></li><li><a href="/tutorials/stock-tracker.html">The "Stock Tracker" Application</a></li><li><a href="/tutorials/stock-tracker.ui.html">UI Markup Using BXML</a></li><li><a href="/tutorials/stock-tracker.events.html">Event Handling</a></li><li><a href="/tutorials/stock-tracker.web-queries.html">Web Queries</a></li><li><a href="/tutorials/stock-tracker.data-binding.html">Data Binding</a></li><li><a href="/tutorials/stock-tracker.localization.html">Localization</a></li><li><a href="/tutorials/bxml-primer.html">BXML Primer</a></li></ul><div class="content"><style type="text/css">
+            applet {
+                border: 1px solid #999999;
+            }
+        </style><!--NOTE: Syntax highlighting script is LGPL--><script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js"></script><script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJava.js"></script><script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushXml.js"></script><script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJScript.js"></script><link type="text/css" rel="stylesheet" href="http://alexgorbatchev.com/pub/sh/current/styles/shCore.css"><link type="text/css" rel="stylesheet" href="http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css"><script type="text/javascript">
+            SyntaxHighlighter.all();
+        </script><div class="section">
+        <p>
+            Menu buttons are similar to <a href="list-buttons.html">list buttons</a>, but provide
+            access to "drop-down" menus rather than list views. They are often used in toolbars,
+            but can be placed anywhere within an application's user interface.
+        </p>
+
+        <p>
+            The following sample application demonstrates the use of a menu button. Selecting an
+            option from the menu button on the left adds the corresponding component type to the
+            content area on the right:
+        </p>
+
+        <script type="text/javascript" src="http://java.com/js/deployJava.js"></script><script type="text/javascript">
+            
+            var attributes = {
+                code:"org.apache.pivot.wtk.BrowserApplicationContext$HostApplet",
+                width:"360",
+                height:"240"
+            };
+
+            
+            
+
+            
+            var libraries = [];
+            libraries.push("/lib/pivot-core-2.0.1.jar");
+                libraries.push("/lib/pivot-wtk-2.0.1.jar");
+                libraries.push("/lib/pivot-wtk-terra-2.0.1.jar");
+                libraries.push("/lib/pivot-tutorials-2.0.1.jar");
+                
+                    libraries.push("/lib/svgSalamander-tiny.jar");
+                
+
+            attributes.archive = libraries.join(",");
+
+            
+            var parameters = {
+                codebase_lookup:false,
+                application_class_name:'org.apache.pivot.wtk.ScriptApplication'
+            };
+
+            
+            var javaArguments = ["-Dsun.awt.noerasebackground=true",
+                "-Dsun.awt.erasebackgroundonresize=true"];
+
+            
+
+            parameters.java_arguments = javaArguments.join(" ");
+
+            
+            
+                var startupProperties = [];
+                
+                    startupProperties.push("src=/org/apache/pivot/tutorials/menus/menu_buttons.bxml");
+                
+                parameters.startup_properties = startupProperties.join("&");
+            
+
+            deployJava.runApplet(attributes, parameters, "1.6");
+        </script>
+
+        <p>
+            The BXML source for the application is as follows:
+        </p>
+
+        <pre class="brush:xml">
+            
+            &lt;menus:MenuButtons title="Menu Buttons" maximized="true"
+                xmlns:bxml="http://pivot.apache.org/bxml"
+                xmlns:content="org.apache.pivot.wtk.content"
+                xmlns:menus="org.apache.pivot.tutorials.menus"
+                xmlns="org.apache.pivot.wtk"&gt;
+                &lt;Border styles="{padding:8}"&gt;
+                    &lt;TablePane styles="{horizontalSpacing:4}"&gt;
+                        &lt;columns&gt;
+                            &lt;TablePane.Column width="-1"/&gt;
+                            &lt;TablePane.Column width="1*"/&gt;
+                        &lt;/columns&gt;
+
+                        &lt;TablePane.Row height="1*"&gt;
+                            &lt;BoxPane orientation="vertical"&gt;
+                                &lt;MenuButton buttonData="Add Component"&gt;
+                                    &lt;Menu&gt;
+                                        &lt;Menu.Section&gt;
+                                            &lt;Menu.Item buttonData="Push Button" action="addPushButton"/&gt;
+                                            &lt;Menu.Item buttonData="Checkbox" action="addCheckbox"/&gt;
+                                            &lt;Menu.Item buttonData="Radio Button" action="addRadioButton"/&gt;
+                                        &lt;/Menu.Section&gt;
+                                    &lt;/Menu&gt;
+                                &lt;/MenuButton&gt;
+                            &lt;/BoxPane&gt;
+
+                            &lt;Border&gt;
+                                &lt;ScrollPane&gt;
+                                    &lt;BoxPane bxml:id="componentBoxPane" orientation="vertical"
+                                        styles="{padding:4, spacing:4}"/&gt;
+                                &lt;/ScrollPane&gt;
+                            &lt;/Border&gt;
+                        &lt;/TablePane.Row&gt;
+                    &lt;/TablePane&gt;
+                &lt;/Border&gt;
+            &lt;/menus:MenuButtons&gt;
+            
+        </pre>
+
+        <p>
+            Like the previous example, it defines a set of menu items that are associated with
+            named actions. The Java source, which defines the actions, is shown below:
+        </p>
+
+        <pre class="brush:java">
+            
+            package org.apache.pivot.tutorials.menus;
+
+            import java.net.URL;
+
+            import org.apache.pivot.beans.Bindable;
+            import org.apache.pivot.collections.Map;
+            import org.apache.pivot.util.Resources;
+            import org.apache.pivot.wtk.Action;
+            import org.apache.pivot.wtk.BoxPane;
+            import org.apache.pivot.wtk.Checkbox;
+            import org.apache.pivot.wtk.Component;
+            import org.apache.pivot.wtk.PushButton;
+            import org.apache.pivot.wtk.RadioButton;
+            import org.apache.pivot.wtk.Window;
+
+            public class MenuButtons extends Window implements Bindable {
+                private BoxPane componentBoxPane = null;
+
+                public MenuButtons() {
+                    Action.getNamedActions().put("addPushButton", new Action() {
+                        @Override
+                        public void perform(Component source) {
+                            componentBoxPane.add(new PushButton("Push button"));
+
+                        }
+                    });
+
+                    Action.getNamedActions().put("addCheckbox", new Action() {
+                        @Override
+                        public void perform(Component source) {
+                            componentBoxPane.add(new Checkbox("Checkbox"));
+                        }
+                    });
+
+                    Action.getNamedActions().put("addRadioButton", new Action() {
+                        @Override
+                        public void perform(Component source) {
+                            componentBoxPane.add(new RadioButton("Radio button"));
+                        }
+                    });
+                }
+
+                @Override
+                public void initialize(Map&lt;String, Object&gt; namespace, URL location, Resources resources) {
+                    componentBoxPane = (BoxPane)namespace.get("componentBoxPane");
+                }
+            }
+            
+        </pre>
+    </div><p>Next: <a href="color-choosers.html">Color Choosers</a></p></div></div></div><div id="footer" class="group"><div class="footerLogo">Copyright (c) 1999-2012<br>The Apache Software Foundation.</div><div class="footerLinks"><ul class="footerMenuGr"><li><strong>Demos</strong><ul><li><a href="/demos/kitchen-sink.html" target="_new">"Kitchen Sink"</a></li><li><a href="/demos/component-explorer.html" target="_new">Component Explorer</a></li><li><a href="http://cwiki.apache.org/confluence/display/PIVOT/Other+Demos" target="_new">Charting</a></li><li><a href="/demos/">More Demos</a></li></ul></li><li><strong>Documentation</strong><ul><li><a href="/getting-started.html">Getting Started</a></li><li><a href="/tutorials/">Tutorial</a></li><li><a href="/faq.html">FAQ</a></li><li><a href="/2.0.1/docs/api/">Javadoc (2.0.1)</a></li></ul></li><li><strong>Get Involved</strong><ul><li><a href="/svn.html">SVN Repositories</a></li><li><a href="/lists.html">Mailing Lists</a></li><li><a
  href="http://issues.apache.org/jira/browse/PIVOT">Bug Database</a></li><li><a href="http://cwiki.apache.org/PIVOT/">Wiki</a></li></ul></li><li><strong>Related</strong><ul><li><a href="http://code.google.com/a/apache-extras.org/p/pivot-jfree/">JFreeChart Provider</a></li><li><a href="http://code.google.com/a/apache-extras.org/p/pivot-common/">Pivot-Common</a></li><li><a href="http://code.google.com/a/apache-extras.org/p/pivot-contrib/">Pivot-Contrib</a></li><li><a href="http://code.google.com/a/apache-extras.org/p/pivot-multilang/">Pivot-Multilang</a></li></ul></li><li><strong>About</strong><ul><li><a href="/who-we-are.html">Who We Are</a></li><li><a href="/contact.html">Contact</a></li><li><a href="http://cwiki.apache.org/confluence/display/PIVOT/News">News</a></li><li><a href="/legal.html">Legal/License</a></li></ul></li></ul></div><div class="footerLinks">
+                	Apache Pivot is a trademark of the Apache Software Foundation
+                </div></div></div></body></html>
\ No newline at end of file