/** * Creates the Tabbed Panel menu * * @return the tabbed panel menu */ private JMenu createTabbedPanelMenu() { JMenu tabbedPanelMenu = new JMenu("Tabbed Panel"); tabbedPanelMenu.add( createMenuItem( "Add a Titled Tab", new ActionListener() { public void actionPerformed(ActionEvent e) { tabbedPanel.addTab(createTab()); } })); tabbedPanelMenu.add(new JSeparator()); // Get all avaliable directions Direction[] directions = Direction.getDirections(); for (int i = 0; i < directions.length; i++) { final Direction direction = directions[i]; tabbedPanelMenu.add( createMenuItem( "Tab Area Orientation: " + direction.getName(), new ActionListener() { public void actionPerformed(ActionEvent e) { // Sets the orientation (direction) for the tab area in the // TabbedPanelProperties // for the tabbed panel. The tabbed panel is automatically // updated. tabbedPanel.getProperties().setTabAreaOrientation(direction); } })); } tabbedPanelMenu.add(new JSeparator()); // Get all available tab layout policies i.e. how the tabs can be laid // out in the tab area TabLayoutPolicy[] tabLayoutPolicies = TabLayoutPolicy.getLayoutPolicies(); for (int i = 0; i < tabLayoutPolicies.length; i++) { final TabLayoutPolicy tabLayoutPolicy = tabLayoutPolicies[i]; tabbedPanelMenu.add( createMenuItem( "Tab Layout: " + tabLayoutPolicy.getName(), new ActionListener() { public void actionPerformed(ActionEvent e) { // Sets the layout for the tab area in the // TabbedPanelProperties // for the tabbed panel. The tabbed panel is automatically // updated. tabbedPanel.getProperties().setTabLayoutPolicy(tabLayoutPolicy); } })); } tabbedPanelMenu.add(new JSeparator()); // Get all available tab drop down list visible policies i.e. when to // show a button (as // a tab area component) that shows a drop down list of all the tabs in // the tabbed panel // where a tab can be selected. TabDropDownListVisiblePolicy[] tabDropDownListVisiblePolicies = TabDropDownListVisiblePolicy.getDropDownListVisiblePolicies(); for (int i = 0; i < tabDropDownListVisiblePolicies.length; i++) { final TabDropDownListVisiblePolicy tabDropDownListVisiblePolicy = tabDropDownListVisiblePolicies[i]; tabbedPanelMenu.add( createMenuItem( "Tab Drop Down List: " + tabDropDownListVisiblePolicy.getName(), new ActionListener() { public void actionPerformed(ActionEvent e) { // Sets the tab drop down list visible policy for the tabbed // panel. The // tabbed panel is automatically updated. tabbedPanel .getProperties() .setTabDropDownListVisiblePolicy(tabDropDownListVisiblePolicy); } })); } tabbedPanelMenu.add(new JSeparator()); tabbedPanelMenu.add( createMenuItem( "Shadow: Enable", new ActionListener() { public void actionPerformed(ActionEvent e) { tabbedPanel .getProperties() .setShadowEnabled(!tabbedPanel.getProperties().getShadowEnabled()); // Enable or disable (toggle) the shadow for the tabbed panel. // The tabbed panel is // automatically updated. ((JMenuItem) e.getSource()) .setText( "Shadow: " + (tabbedPanel.getProperties().getShadowEnabled() ? "Disable" : "Enable")); } })); return tabbedPanelMenu; }