new JTable(model)
or new JList(items)
. With RADi you can not do this because, at the time your code executes, the GUI already is constructed. So this section shows some ways of updating the data (model) of lists, trees and tables.
setupFrame
respective setupDialog
.
NewLayout
layout manager. First you need a reference to the container (this is either the top container, the internal panel, the folder panel or an internal frame's content pane). For this container you must then call the two-argument add
method with the component to add as the first argument and a NLConstraint
object as the second argument, for example:
container.add(component, NLConstraint.rc(2, 0));
|
container.add(component, NLConstraint.rcwh(2, 0, 2, 1, "lr"));
|
BorderLayout
. The border layout is set for the content pane and has two children: the tool bar and a JPanel
containing the design grid. To add a component to the grid, you must first get a reference to the JPanel
, using code like this:
Container container = null;
|
NewLayout
and NLConstraint
in the RADi runtime Javadoc at .../RADi/javadocs
.
JComboBox(Object[] items)
or with JComboBox(Vector items)
.
![]() |
Define your own ComboBoxModel and set it with
| |
![]() |
Set the data with
| |
![]() |
Set the data with
|
JList(Object[] items)
or with JList(Vector items)
.
![]() |
Define your own ListModel and set it with
| |
![]() |
Set the data with
| |
![]() |
Set the data with
|
TreeModel
interface or extend DefaultTreeModel
, your choice should depend on the kind of data you are representing.
DefaultTreeModel
. So you can also define a tree's data by creating a root node (as an instance of DefaultMutableTreeNode
), then adding other nodes as needed and finally setting the model's root node with
((DefaultTreeModel)tree.getModel()).setRoot(myRootNode);
|
DefaultTableModel
or by a RadiTableModel
(which is derived from DefaultTableModel
). So, to completely redefine table data you have three choices:
![]() |
Define your own TableModel and set it with
| |
![]() |
Set the data with
| |
![]() |
Set the data with
|
JList
, JComboBox
or JTree
(see Define a controller for a CardPanel).
![]() |
In RADi insert the card panel and add cards as needed (you may also want to edit the CardLayout 's
).
| |
![]() |
For every card insert a selectable button in the layout (radio buttons, toggle buttons or radio menu items). Then, for each button, set its actionCommand
to the constraint of the card you want to be displayed as the button is clicked.
| |
![]() |
Create a button group from all controller buttons (so only one can be selected at a time). To do this, select all buttons for the group and execute 'Create Button Group' from the grid's or from the 'Edit' menu. | |
![]() |
For every controller button define an
whose actionPerformed() method is forwarded to the same target method (switchCard() ). It is important that the ActionEvent is forwarded.
| |
![]() |
Export the layout, then edit the source code like this:
|