|
JavaTM 2 Platform Standard Edition |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--javax.swing.JList
A component that allows the user to select one or more objects from a
list. A separate model, ListModel
, represents the contents
of the list. It's easy to display an array or vector of objects, using
a JList
constructor that builds an ListModel
instance for you:
// Create a JList that displays the strings in data[] String[] data = {"one", "two", "free", "four"}; JList dataList = new JList(data); // The value of the JList model property is an object that provides // a read-only view of the data. It was constructed automatically. for(int i = 0; i < dataList.getModel().getSize(); i++) { System.out.println(dataList.getModel().getElementAt(i)); } // Create a JList that displays the superclass of JList.class. // We store the superclasses in a java.util.Vector. Vector superClasses = new Vector(); Class rootClass = javax.swing.JList.class; for(Class cls = rootClass; cls != null; cls = cls.getSuperclass()) { superClasses.addElement(cls); } JList classList = new JList(superClasses);
JList doesn't support scrolling directly. To create a scrolling list you make the JList the viewport view of a JScrollPane, e.g.
JScrollPane scrollPane = new JScrollPane(dataList); // Or in two steps: JScrollPane scrollPane = new JScrollPane(); scrollPane.getViewport().setView(dataList);
By default JList
supports single selection, i.e. zero or one
index can be selected. The selection state is actually managed
by a separate delegate object, an implementation of ListSelectionModel
however JList
provides convenient properties for managing the selection.
String[] data = {"one", "two", "free", "four"}; JList dataList = new JList(data); dataList.setSelectedIndex(1); // select "two" dataList.getSelectedValue(); // returns "two"
The contents of a JList
can be dynamic, i.e. the list elements can
change value and the size of the list can change after the JList has
been created. The JList
observes changes in its model with a
swing.event.ListDataListener
implementation. A correct
implementation of ListModel
notifies
it's listeners each time a change occurs. The changes are
characterized by a swing.event.ListDataEvent
, which identifies
the range of List indices that have been modified, added, or removed.
Simple dynamic-content JList
applications can use the
DefaultListModel
class to store list elements. This class
implements the ListModel
interface and provides the
java.util.Vector
API as well. Applications that need to
provide custom ListModel
implementations can subclass
AbstractListModel
, which provides basic
ListDataListener
support. For example:
// This list model has about 2^16 elements. Enjoy scrolling. ListModel bigData = new AbstractListModel() { public int getSize() { return Short.MAX_VALUE; } public Object getElementAt(int index) { return "Index " + index; } }; JList bigDataList = new List(bigData); // We don't want the JList implementation to compute the width // or height of all of the list cells, so we give it a String // that's as big as we'll need for any cell. It uses this to // compute values for the fixedCellWidth and fixedCellHeight // properties. bigDataList.setPrototypeCellValue("Index 1234567890");
JList
uses a java.awt.Component
, provided by
a delegate called the
cellRendererer
, to paint the visible cells in the list.
The cell renderer component is used like a "rubber stamp" to paint
each visible row. Each time the JList
needs to paint a cell
it asks the cell renderer for the component, moves it into place
using setBounds()
and then draws it by calling its paint method.
The default cell renderer uses a JLabel
component to render
the string value of each component. You can substitute your
own cell renderer, using code like this:
// Display an icon and a string for each object in the list. class MyCellRenderer extends JLabel implements ListCellRenderer { final static ImageIcon longIcon = new ImageIcon("long.gif"); final static ImageIcon shortIcon = new ImageIcon("short.gif"); // This is the only method defined by ListCellRenderer. We just // reconfigure the Jlabel each time we're called. public Component getListCellRendererComponent( JList list, Object value, // value to display int index, // cell index boolean isSelected, // is the cell selected boolean cellHasFocus) // the list and the cell have the focus { String s = value.toString(); setText(s); setIcon((s.length() > 10) ? longIcon : shortIcon); if (isSelected) { setBackground(list.getSelectionBackground()); setForeground(list.getSelectionForeground()); } else { setBackground(list.getBackground()); setForeground(list.getForeground()); } setEnabled(list.isEnabled()); setFont(list.getFont()); return this; } } String[] data = {"one", "two", "free", "four"}; JList dataList = new JList(data); dataList.setCellRenderer(new MyCellRenderer());
JList
doesn't provide any special support for handling double or
triple (or N) mouse clicks however it's easy to handle them using
a MouseListener
. Use the JList
method
locationToIndex()
to
determine what cell was clicked. For example:
final JList list = new JList(dataModel); MouseListener mouseListener = new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { int index = list.locationToIndex(e.getPoint()); System.out.println("Double clicked on Item " + index); } } }; list.addMouseListener(mouseListener);Note that in this example the JList variable is
final
because it's referred to by the anonymous MouseListener class.
For the keyboard keys used by this component in the standard Look and Feel (L&F) renditions, see the JList key assignments.
Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.
ListModel
,
AbstractListModel
,
DefaultListModel
,
ListSelectionModel
,
DefaultListSelectionModel
,
ListCellRenderer
, Serialized FormInner Class Summary | |
protected class |
JList.AccessibleJList
The class used to obtain the accessible role for this object. |
Inner classes inherited from class javax.swing.JComponent |
JComponent.AccessibleJComponent |
Fields inherited from class javax.swing.JComponent |
accessibleContext,
listenerList,
TOOL_TIP_TEXT_KEY,
ui,
UNDEFINED_CONDITION,
WHEN_ANCESTOR_OF_FOCUSED_COMPONENT,
WHEN_FOCUSED,
WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT,
CENTER_ALIGNMENT,
LEFT_ALIGNMENT,
RIGHT_ALIGNMENT,
TOP_ALIGNMENT |
Constructor Summary | |
JList()
Constructs a JList with an empty model. |
|
JList(ListModel dataModel)
Construct a JList that displays the elements in the specified, non-null model. |
|
JList(Object[] listData)
Construct a JList that displays the elements in the specified array. |
|
JList(Vector listData)
Construct a JList that displays the elements in the specified Vector. |
Method Summary | |
void |
addListSelectionListener(ListSelectionListener listener)
Add a listener to the list that's notified each time a change to the selection occurs. |
void |
addSelectionInterval(int anchor,
int lead)
Set the selection to be the union of the specified interval with current selection. |
void |
clearSelection()
Clears the selection - after calling this method isSelectionEmpty() will return true. |
protected ListSelectionModel |
createSelectionModel()
Returns an instance of DefaultListSelectionModel. |
void |
ensureIndexIsVisible(int index)
If this JList is being displayed within a JViewport and the specified cell isn't completely visible, scroll the viewport. |
protected void |
fireSelectionValueChanged(int firstIndex,
int lastIndex,
boolean isAdjusting)
This method notifies JList ListSelectionListeners that the selection model has changed. |
AccessibleContext |
getAccessibleContext()
Get the AccessibleContext associated with this JComponent |
int |
getAnchorSelectionIndex()
Returns the first index argument from the most recent addSelectionInterval or setSelectionInterval call. |
Rectangle |
getCellBounds(int index1,
int index2)
Returns the bounds of the specified range of items in JList coordinates, null if index isn't valid. |
ListCellRenderer |
getCellRenderer()
Returns the object that renders the list items. |
int |
getFirstVisibleIndex()
Return the index of the cell in the upper left corner of the JList or -1 if nothing is visible or the list is empty. |
int |
getFixedCellHeight()
Returns the fixed cell width value -- the value specified by setting the fixedCellHeight property, rather than calculated from the list elements. |
int |
getFixedCellWidth()
Returns the fixed cell width value -- the value specified by setting the fixedCellWidth property, rather than calculated from the list elements. |
int |
getLastVisibleIndex()
Return the index of the cell in the lower right corner of the JList or -1 if nothing is visible or the list is empty. |
int |
getLeadSelectionIndex()
Returns the second index argument from the most recent addSelectionInterval or setSelectionInterval call. |
int |
getMaxSelectionIndex()
Returns the largest selected cell index. |
int |
getMinSelectionIndex()
Returns the smallest selected cell index. |
ListModel |
getModel()
Returns the data model that holds the list of items displayed by the JList component. |
Dimension |
getPreferredScrollableViewportSize()
Compute the size of the viewport needed to display visibleRowCount rows. |
Object |
getPrototypeCellValue()
Returns the cell width of the "prototypical cell" -- a cell used for the calculation of cell widths, because it has the same value as all other list items, instead of forcing the calculation to inspect every item in the list. |
int |
getScrollableBlockIncrement(Rectangle visibleRect,
int orientation,
int direction)
Returns the block increment amount. |
boolean |
getScrollableTracksViewportHeight()
If this JList is displayed in a JViewport, don't change its height when the viewports height changes. |
boolean |
getScrollableTracksViewportWidth()
If this JList is displayed in a JViewport, don't change its width when the viewports width changes. |
int |
getScrollableUnitIncrement(Rectangle visibleRect,
int orientation,
int direction)
Horizontal scrolling: return the lists font size or 1 if the font is null. |
int |
getSelectedIndex()
A convenience method that returns the first selected index. |
int[] |
getSelectedIndices()
Return an array of all of the selected indices in increasing order. |
Object |
getSelectedValue()
A convenience method that returns the first selected value or null, if the selection is empty. |
Object[] |
getSelectedValues()
Return an array of the values for the selected cells. |
Color |
getSelectionBackground()
Returns the background color for selected cells. |
Color |
getSelectionForeground()
Returns the foreground color. |
int |
getSelectionMode()
Returns whether single-item or multiple-item selections are allowed. |
ListSelectionModel |
getSelectionModel()
Returns the value of the current selection model. |
ListUI |
getUI()
Returns the L&F object that renders this component. |
String |
getUIClassID()
Returns the name of the UIFactory class that generates the look and feel for this component. |
boolean |
getValueIsAdjusting()
Returns the value of the data model's isAdjusting property. |
int |
getVisibleRowCount()
Return the preferred number of visible rows. |
Point |
indexToLocation(int index)
Returns the origin of the specified item in JList coordinates, null if index isn't valid. |
boolean |
isSelectedIndex(int index)
Returns true if the specified index is selected. |
boolean |
isSelectionEmpty()
Returns true if nothing is selected This is a convenience method that just delegates to the selectionModel. |
int |
locationToIndex(Point location)
Convert a point in JList coordinates to the index of the cell at that location. |
protected String |
paramString()
Returns a string representation of this JList. |
void |
removeListSelectionListener(ListSelectionListener listener)
Remove a listener from the list that's notified each time a change to the selection occurs. |
void |
removeSelectionInterval(int index0,
int index1)
Set the selection to be the set difference of the specified interval and the current selection. |
void |
setCellRenderer(ListCellRenderer cellRenderer)
Sets the delegate that's used to paint each cell in the list. |
void |
setFixedCellHeight(int height)
If this value is greater than zero it defines the height of every cell in the list. |
void |
setFixedCellWidth(int width)
If this value is greater than zero it defines the width of every cell in the list. |
void |
setListData(Object[] listData)
A convenience method that constructs a ListModel from an array of Objects and then applies setModel to it. |
void |
setListData(Vector listData)
A convenience method that constructs a ListModel from a Vector and then applies setModel to it. |
void |
setModel(ListModel model)
Sets the model that represents the contents or "value" of the list and clears the list selection after notifying PropertyChangeListeners. |
void |
setPrototypeCellValue(Object prototypeCellValue)
If this value is non-null it's used to compute fixedCellWidth and fixedCellHeight by configuring the cellRenderer at index equals zero for the specified value and then computing the renderer components preferred size. |
void |
setSelectedIndex(int index)
Select a single cell. |
void |
setSelectedIndices(int[] indices)
Select a set of cells. |
void |
setSelectedValue(Object anObject,
boolean shouldScroll)
Selects the specified object from the list. |
void |
setSelectionBackground(Color selectionBackground)
Set the background color for selected cells. |
void |
setSelectionForeground(Color selectionForeground)
Set the foreground color for selected cells. |
void |
setSelectionInterval(int anchor,
int lead)
Select the specified interval. |
void |
setSelectionMode(int selectionMode)
Determines whether single-item or multiple-item selections are allowed. |
void |
setSelectionModel(ListSelectionModel selectionModel)
Set the selectionModel for the list to a non-null ListSelectionModel implementation. |
void |
setUI(ListUI ui)
Sets the L&F object that renders this component. |
void |
setValueIsAdjusting(boolean b)
Sets the data model's isAdjusting property true, so that a single event will be generated when all of the selection events have finished (for example, when the mouse is being dragged over the list in selection mode). |
void |
setVisibleRowCount(int visibleRowCount)
Set the preferred number of rows in the list that can be displayed without a scollbar, as determined by the nearest JViewport ancestor, if any. |
void |
updateUI()
Set the UI property with the "ListUI" from the current default UIFactory. |
Methods inherited from class java.awt.Container |
add,
add,
add,
add,
add,
addContainerListener,
addImpl,
countComponents,
deliverEvent,
doLayout,
findComponentAt,
findComponentAt,
getComponent,
getComponentAt,
getComponentAt,
getComponentCount,
getComponents,
getLayout,
insets,
invalidate,
isAncestorOf,
layout,
list,
list,
locate,
minimumSize,
paintComponents,
preferredSize,
print,
printComponents,
processContainerEvent,
processEvent,
remove,
remove,
removeAll,
removeContainerListener,
setCursor,
setLayout,
validate,
validateTree |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Constructor Detail |
public JList(ListModel dataModel)
public JList(Object[] listData)
public JList(Vector listData)
public JList()
Method Detail |
public ListUI getUI()
public void setUI(ListUI ui)
ui
- the ListUI L&F objectUIDefaults.getUI(javax.swing.JComponent)
public void updateUI()
UIManager.getUI(javax.swing.JComponent)
public String getUIClassID()
JComponent.getUIClassID()
,
UIDefaults.getUI(javax.swing.JComponent)
public Object getPrototypeCellValue()
setPrototypeCellValue(java.lang.Object)
public void setPrototypeCellValue(Object prototypeCellValue)
The default value of this property is null.
This is a JavaBeans bound property. Note that we do set the fixedCellWidth and fixedCellHeight properties here but only a prototypeCellValue PropertyChangeEvent is fired.
the
- value to base fixedCellWidth and fixedCellHeight ongetPrototypeCellValue()
,
setFixedCellWidth(int)
,
setFixedCellHeight(int)
,
JComponent.addPropertyChangeListener(java.beans.PropertyChangeListener)
public int getFixedCellWidth()
setFixedCellWidth(int)
public void setFixedCellWidth(int width)
The default value of this property is -1.
This is a JavaBeans bound property.
the
- width for all cells in this listgetPrototypeCellValue()
,
setFixedCellWidth(int)
,
JComponent.addPropertyChangeListener(java.beans.PropertyChangeListener)
public int getFixedCellHeight()
setFixedCellHeight(int)
public void setFixedCellHeight(int height)
The default value of this property is -1.
This is a JavaBeans bound property.
height
- an int giving the height in pixels for all cells
in this listgetPrototypeCellValue()
,
setFixedCellWidth(int)
,
JComponent.addPropertyChangeListener(java.beans.PropertyChangeListener)
public ListCellRenderer getCellRenderer()
setCellRenderer(javax.swing.ListCellRenderer)
public void setCellRenderer(ListCellRenderer cellRenderer)
The default value of this property is provided by the ListUI delegate, i.e. by the look and feel implementation.
This is a JavaBeans bound property.
cellRenderer
- the ListCellRenderer that paints list cellsgetCellRenderer()
public Color getSelectionForeground()
setSelectionForeground(java.awt.Color)
,
setSelectionBackground(java.awt.Color)
public void setSelectionForeground(Color selectionForeground)
The default value of this property is defined by the look and feel implementation.
This is a JavaBeans bound property.
selectionForeground
- the Color to use in the foreground
for selected list itemsgetSelectionForeground()
,
setSelectionBackground(java.awt.Color)
,
JComponent.setForeground(java.awt.Color)
,
JComponent.setBackground(java.awt.Color)
,
JComponent.setFont(java.awt.Font)
public Color getSelectionBackground()
setSelectionBackground(java.awt.Color)
,
setSelectionForeground(java.awt.Color)
public void setSelectionBackground(Color selectionBackground)
The default value of this property is defined by the look and feel implementation.
This is a JavaBeans bound property.
selectionBackground
- the Color to use for the background
of selected cellsgetSelectionBackground()
,
setSelectionForeground(java.awt.Color)
,
JComponent.setForeground(java.awt.Color)
,
JComponent.setBackground(java.awt.Color)
,
JComponent.setFont(java.awt.Font)
public int getVisibleRowCount()
setVisibleRowCount(int)
public void setVisibleRowCount(int visibleRowCount)
The default value of this property is 8.
This is a JavaBeans bound property.
visibleRowCount
- an int specifying the preferred number of
visible rowsgetVisibleRowCount()
,
JComponent.getVisibleRect()
,
JViewport
public int getFirstVisibleIndex()
getLastVisibleIndex()
,
JComponent.getVisibleRect()
public int getLastVisibleIndex()
getLastVisibleIndex()
,
JComponent.getVisibleRect()
public void ensureIndexIsVisible(int index)
an
- int -- the index of the cell to make visibleJComponent.scrollRectToVisible(java.awt.Rectangle)
,
JComponent.getVisibleRect()
public int locationToIndex(Point location)
location
- The JList relative coordinates of the cellpublic Point indexToLocation(int index)
index
- The index of the JList cell.public Rectangle getCellBounds(int index1, int index2)
index1
- the index of the first JList cell in the rangeindex2
- the index of the last JList cell in the rangepublic ListModel getModel()
setModel(javax.swing.ListModel)
public void setModel(ListModel model)
This is a JavaBeans bound property.
model
- the ListModel that provides the list of items for displaygetModel()
public void setListData(Object[] listData)
listData
- an array of Objects containing the items to display
in the listsetModel(javax.swing.ListModel)
public void setListData(Vector listData)
listData
- a Vector containing the items to display in the listsetModel(javax.swing.ListModel)
protected ListSelectionModel createSelectionModel()
setSelectionModel(javax.swing.ListSelectionModel)
,
DefaultListSelectionModel
public ListSelectionModel getSelectionModel()
setSelectionModel(javax.swing.ListSelectionModel)
,
ListSelectionModel
protected void fireSelectionValueChanged(int firstIndex, int lastIndex, boolean isAdjusting)
public void addListSelectionListener(ListSelectionListener listener)
listener
- The ListSelectionListener to add.getSelectionModel()
public void removeListSelectionListener(ListSelectionListener listener)
listener
- The ListSelectionListener to remove.addListSelectionListener(javax.swing.event.ListSelectionListener)
,
getSelectionModel()
public void setSelectionModel(ListSelectionModel selectionModel)
This is a JavaBeans bound property.
getSelectionModel()
public void setSelectionMode(int selectionMode)
SINGLE_SELECTION
Only one list index can be selected at a time. In this
mode the setSelectionInterval and addSelectionInterval
methods are equivalent, and they only the first index
argument is used.
SINGLE_INTERVAL_SELECTION
One contiguous index interval can be selected at a time.
In this mode setSelectionInterval and addSelectionInterval
are equivalent.
MULTIPLE_INTERVAL_SELECTION
In this mode, there's no restriction on what can be selected.
selectionMode
- an int specifying the type of selections
that are permissiblegetSelectionMode()
public int getSelectionMode()
setSelectionMode(int)
public int getAnchorSelectionIndex()
ListSelectionModel.getAnchorSelectionIndex()
,
addSelectionInterval(int, int)
,
setSelectionInterval(int, int)
,
addListSelectionListener(javax.swing.event.ListSelectionListener)
public int getLeadSelectionIndex()
ListSelectionModel.getLeadSelectionIndex()
,
addSelectionInterval(int, int)
,
setSelectionInterval(int, int)
,
addListSelectionListener(javax.swing.event.ListSelectionListener)
public int getMinSelectionIndex()
ListSelectionModel.getMinSelectionIndex()
,
addListSelectionListener(javax.swing.event.ListSelectionListener)
public int getMaxSelectionIndex()
ListSelectionModel.getMaxSelectionIndex()
,
addListSelectionListener(javax.swing.event.ListSelectionListener)
public boolean isSelectedIndex(int index)
ListSelectionModel.isSelectedIndex(int)
,
setSelectedIndex(int)
,
addListSelectionListener(javax.swing.event.ListSelectionListener)
public boolean isSelectionEmpty()
ListSelectionModel.isSelectionEmpty()
,
clearSelection()
,
addListSelectionListener(javax.swing.event.ListSelectionListener)
public void clearSelection()
public void setSelectionInterval(int anchor, int lead)
anchor
- The first index to selectlead
- The last index to selectListSelectionModel.setSelectionInterval(int, int)
,
addSelectionInterval(int, int)
,
removeSelectionInterval(int, int)
,
addListSelectionListener(javax.swing.event.ListSelectionListener)
public void addSelectionInterval(int anchor, int lead)
anchor
- The first index to add to the selectionlead
- The last index to add to the selectionListSelectionModel.addSelectionInterval(int, int)
,
setSelectionInterval(int, int)
,
removeSelectionInterval(int, int)
,
addListSelectionListener(javax.swing.event.ListSelectionListener)
public void removeSelectionInterval(int index0, int index1)
anchor
- The first index to remove from the selectionlead
- The last index to remove from the selectionListSelectionModel.removeSelectionInterval(int, int)
,
setSelectionInterval(int, int)
,
addSelectionInterval(int, int)
,
addListSelectionListener(javax.swing.event.ListSelectionListener)
public void setValueIsAdjusting(boolean b)
b
- the boolean value for the property valueListSelectionModel.setValueIsAdjusting(boolean)
public boolean getValueIsAdjusting()
ListSelectionModel.getValueIsAdjusting()
public int[] getSelectedIndices()
removeSelectionInterval(int, int)
,
addListSelectionListener(javax.swing.event.ListSelectionListener)
public void setSelectedIndex(int index)
index
- The index of the one cell to selectListSelectionModel.setSelectionInterval(int, int)
,
isSelectedIndex(int)
,
addListSelectionListener(javax.swing.event.ListSelectionListener)
public void setSelectedIndices(int[] indices)
indices
- The indices of the cells to selectListSelectionModel.addSelectionInterval(int, int)
,
isSelectedIndex(int)
,
addListSelectionListener(javax.swing.event.ListSelectionListener)
public Object[] getSelectedValues()
isSelectedIndex(int)
,
getModel()
,
addListSelectionListener(javax.swing.event.ListSelectionListener)
public int getSelectedIndex()
getMinSelectionIndex()
,
addListSelectionListener(javax.swing.event.ListSelectionListener)
public Object getSelectedValue()
getMinSelectionIndex()
,
getModel()
,
addListSelectionListener(javax.swing.event.ListSelectionListener)
public void setSelectedValue(Object anObject, boolean shouldScroll)
anObject
- the Object to selectshouldScroll
- true if the list should scroll to display
the selected objectpublic Dimension getPreferredScrollableViewportSize()
public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction)
Vertical scrolling: if we're scrolling downwards (direction
is
greater than 0), and the first row is completely visible with respect
to visibleRect
, then return its height. If
we're scrolling downwards and the first row is only partially visible,
return the height of the visible part of the first row. Similarly
if we're scrolling upwards we return the height of the row above
the first row, unless the first row is partially visible.
Scrollable.getScrollableUnitIncrement(java.awt.Rectangle, int, int)
public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction)
Scrollable.getScrollableUnitIncrement(java.awt.Rectangle, int, int)
public boolean getScrollableTracksViewportWidth()
Scrollable.getScrollableTracksViewportWidth()
public boolean getScrollableTracksViewportHeight()
Scrollable.getScrollableTracksViewportWidth()
protected String paramString()
null
.public AccessibleContext getAccessibleContext()
|
JavaTM 2 Platform Standard Edition |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |