Containers in grid cells
Traversing the container hierarchy JTabbedPane JSplitPane JScrollPane JMenuBar JToolBar The purpose of a container is to hold other components. First we look at containers in general, then we discuss some special ones. To add a component to a container, first insert the container in a grid cell and then drag the component to the same cell (if you reverse these two steps, then you apply the container to the component).
You can also convert a (contiguous) selection into a container (one of JPanel , FolderPanel , JDesktopPane or JLayeredPane ). You find the appropriate commands in the grid context menu.
JPanel or FolderPanel , the selection is replaced by a panel containing the selection (with JPanel you will see no difference). In case of JDesktopPane or JLayeredPane , the selection is added as the pane's content panel and is then replaced by the pane.
Traversing the container hierarchy Top of page To select a component inside a container, maybe to adjust its properties, you can either double-click the container or you can select the desired component in the project view. In both cases you switch to the next hierarchy level.
The Navigator window You can easily traverse the container hierarchy using the Navigator (select 'Window | Navigator' or press F9 ).The Navigator window displays an overview of the container hierarchy. As you move the mouse on a container icon, this container is marked in the layout. As you click the mouse, the container (respective its content) will be displayed.
JTabbedPane Top of page Whenever you add a component to a tabbed pane, a new tab is generated (showing the variable name of the component) and the component is made the selected component. To select another tab, to remove a tab from the tabbed pane or to rearrange tabs, select the according menu item from the tabbed pane's context menu.
JSplitPane Top of page A JSplitPane can hold only two components. The first component you add is added as the top/left component, the second at the bottom/right position. If you try to add one more component, a dialog appears, where you can decide to add this component as the splitpane's top/left or bottom/right component (or not at all). The 'Switch Components' command from the splitpane's context menu switches both components.
JScrollPane Top of page JScrollPane requires some special care to work as expected. You should know that a scrollpane's preferred size is calculated from the preferred size of its viewport component, respectively, if the viewport component implements Scrollable , from its preferredScrollableViewportSize property.
JMenuBar Top of page Normally a JMenuBar is added to a JFrame/JInternalFrame/JDialog/JApplet with setJMenuBar() . The RADi runtime library will do this if the menubar is positioned in the first row of the design grid with no other components in that row.
As you insert a JMenuBar into a layout grid, the menubar is populated with some default menus. To change this default, you edit the menu hierarchy in the Menu Editor and click 'Save as default'.
JToolBar Top of page JToolBar is traditionally added to an empty BorderLayout , so you can move the toolbar to the NORTH , EAST , WEST or SOUTH position (or drag it out of the container into its own window). The RADi runtime library will do this if
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
See also: The Top container CardPanel Folder Panel Internal panels Internal Frames and Palettes JLayeredPane and JDesktopPane | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||