| <?xml version="1.0" encoding="UTF-8"?> |
| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to you under the Apache License, |
| Version 2.0 (the "License"); you may not use this file except in |
| compliance with the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| 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. |
| --> |
| |
| <document id="grid-panes"> |
| <properties> |
| <title>Grid Panes</title> |
| </properties> |
| |
| <body> |
| <p> |
| Grid panes are used to arrange components in a fixed two-dimensional grid. Grid panes |
| have a "columnCount" property that defines the column structure of the grid and a "rows" |
| collection that defines both the row structure of the grid and the contents of each |
| row. |
| </p> |
| |
| <p> |
| Each cell in a grid pane is given the same size, based on the available width and |
| height. For more complex table layouts, <tt>TablePane</tt>, discussed next, may be |
| used. |
| </p> |
| |
| <p> |
| Below is a simple application that demonstrates the use of the <tt>GridPane</tt> |
| component. Note the use of the <tt>GridPane.Filler</tt> component, which is used to |
| insert empty cells: |
| </p> |
| |
| <application class="org.apache.pivot.wtk.ScriptApplication" |
| width="360" height="360"> |
| <libraries> |
| <library>core</library> |
| <library>wtk</library> |
| <library>wtk-terra</library> |
| <library>tutorials</library> |
| </libraries> |
| <startup-properties> |
| <src>/org/apache/pivot/tutorials/layout/grid_panes.bxml</src> |
| </startup-properties> |
| </application> |
| |
| <p> |
| The BXML source for the application is shown below: |
| </p> |
| |
| <source type="xml" location="org/apache/pivot/tutorials/layout/grid_panes.bxml"> |
| <![CDATA[ |
| <Window title="Grid Panes" maximized="true" |
| xmlns:bxml="http://pivot.apache.org/bxml" |
| xmlns="org.apache.pivot.wtk"> |
| <Border> |
| <GridPane columnCount="5" styles="{horizontalSpacing:1, verticalSpacing:1, |
| showHorizontalGridLines:true, showVerticalGridLines:true}"> |
| <GridPane.Row> |
| <Label text="0, 0" styles="{horizontalAlignment:'center', |
| verticalAlignment:'center'}"/> |
| <Label text="0, 1" styles="{horizontalAlignment:'center', |
| verticalAlignment:'center'}"/> |
| <Label text="0, 2" styles="{horizontalAlignment:'center', |
| verticalAlignment:'center'}"/> |
| <Label text="0, 3" styles="{horizontalAlignment:'center', |
| verticalAlignment:'center'}"/> |
| <GridPane.Filler/> |
| </GridPane.Row> |
| |
| <GridPane.Row> |
| <Label text="1, 0" styles="{horizontalAlignment:'center', |
| verticalAlignment:'center'}"/> |
| <Label text="1, 1" styles="{horizontalAlignment:'center', |
| verticalAlignment:'center'}"/> |
| <Label text="1, 2" styles="{horizontalAlignment:'center', |
| verticalAlignment:'center'}"/> |
| <GridPane.Filler/> |
| <Label text="1, 4" styles="{horizontalAlignment:'center', |
| verticalAlignment:'center'}"/> |
| </GridPane.Row> |
| |
| <GridPane.Row> |
| <Label text="2, 0" styles="{horizontalAlignment:'center', |
| verticalAlignment:'center'}"/> |
| <Label text="2, 1" styles="{horizontalAlignment:'center', |
| verticalAlignment:'center'}"/> |
| <GridPane.Filler/> |
| <Label text="2, 3" styles="{horizontalAlignment:'center', |
| verticalAlignment:'center'}"/> |
| <Label text="2, 4" styles="{horizontalAlignment:'center', |
| verticalAlignment:'center'}"/> |
| </GridPane.Row> |
| |
| <GridPane.Row> |
| <Label text="3, 0" styles="{horizontalAlignment:'center', |
| verticalAlignment:'center'}"/> |
| <GridPane.Filler/> |
| <Label text="3, 2" styles="{horizontalAlignment:'center', |
| verticalAlignment:'center'}"/> |
| <Label text="3, 3" styles="{horizontalAlignment:'center', |
| verticalAlignment:'center'}"/> |
| <Label text="3, 4" styles="{horizontalAlignment:'center', |
| verticalAlignment:'center'}"/> |
| </GridPane.Row> |
| |
| <GridPane.Row> |
| <GridPane.Filler/> |
| <Label text="4, 1" styles="{horizontalAlignment:'center', |
| verticalAlignment:'center'}"/> |
| <Label text="4, 2" styles="{horizontalAlignment:'center', |
| verticalAlignment:'center'}"/> |
| <Label text="4, 3" styles="{horizontalAlignment:'center', |
| verticalAlignment:'center'}"/> |
| <Label text="4, 4" styles="{horizontalAlignment:'center', |
| verticalAlignment:'center'}"/> |
| </GridPane.Row> |
| </GridPane> |
| </Border> |
| </Window> |
| ]]> |
| </source> |
| |
| <p> |
| Since this application contains no logic, there is no associated Java source. |
| </p> |
| </body> |
| </document> |