JGoodies Binding :: Guide :: View Adapters
Author: Karsten Lentzsch
Description: The JGoodies Binding provides an elegant means to present object properties in a user interface.
Keywords: JGoodies Data Binding Java Swing UI Design Usability Lentzsch Kiel

# :: Guide :: View Adapters :: Find below two lists that show the typical ways to bind single values and collections to Swing components. There are two convenience classes that assist in choosing the appropriate adapter and in binding a ValueModel to a Swing component: The `BasicComponentFactory` can create Swing components that are bound to a ValueModel; the factory chooses the appropriate adapter. The `Bindings` class is useful if you already have a component factory, or if you are using customized versions of the standard Swing components. the more basic `Bindings` class. It establishes the connection between a ValueModel and a given Swing component by setting the appropriate ValueModel adapter as the component's model. ## Adapting Single Values This table shows how to convert ValueModels to Swing component models. See also the `ComponentsExample` in the accompanying tutorial.
Component Type | Adapter / Connector
JCheckBox | ToggleButtonAdapter
JCheckBoxMenuItem | ToggleButtonAdapter
JColorChooser | ColorSelectionAdapter
JFormattedTextField | PropertyConnector
JLabel | PropertyConnector
JPasswordField | TextComponentConnector
JSlider | BoundedRangeAdapter
JTextArea | TextComponentConnector
JTextField | TextComponentConnector
JToggleButton | ToggleButtonAdapter
JRadioButton | RadioButtonAdapter
JRadioButtonMenuItem | RadioButtonAdapter
## Adapting Collections This table shows how to bind lists to JComboBox, JList and JTable. See also the `MasterDetailsXXXExample`s in the accompanying tutorial.
Component Type | Adapter / Connector
JComboBox | ComboBoxAdapter on a ListModel or SelectionInList
JList | SelectionInList or ListModel
JTable | AbstractTableAdapter wrapping a SelectionInList or AbstractTableAdapter wrapping a ListModel or Custom TableModel
(c) 2010 JGoodies |  |