- Inherits from:
- NSMatrix : NSControl : NSView : NSResponder : NSObject
- Package:
- com.apple.yellow.application
An NSForm is a vertical NSMatrix of NSFormCells. Here's an example:
In NSForm's methods, each NSFormCell is called an "entry" (or, sometimes, a "cell" or "item"). The left part of each entry is called the "title," and the right part is called the "text." Methods that refer to individual entries use an one-dimensional "index"; the indexing system starts at the top of the top of form, with zero.
Any entry in the form can be "selected." When an entry is selected, its text area responds to the user's keystrokes. You can select an entry using the selectTextAtIndex method, or you can let the user select an entry by clicking it with the mouse. Once an entry is selected, the user can select the next entry by pressing Tab, or select the previous entry by pressing Shift-Tab.
To initiate the action of a selected entry, the user presses Return or Enter. In response, the entry sends an action message to its target. If the entry has no target, the NSForm sends an action message to its target.
NSForm includes a methods to change the appearance of entries (the set... methods). These methods affect every entry in the form. To change the appearance of an individual entry, you need to single it out, using cellAtIndex, and then send it messages appropriate to an "NSFormCell" .
For more information, see the class specifications for "NSFormCell" and NSMatrix.
- Constructors
- NSForm
- Adding and removing entries
- addEntry
- insertEntryAtIndex
- removeEntryAtIndex
- Changing the appearance of all the entries
- setBezeled
- setBordered
- setEntryWidth
- setInterlineSpacing
- setTitleAlignment
- setTextAlignment
- setTitleFont
- setTextFont
- Getting cells and indices
- indexOfCellWithTag
- indexOfSelectedItem
- cellAtIndex
- Displaying a cell
- drawCellAtIndex
- Editing text
- selectTextAtIndex
public NSForm()
public NSForm(NSRect aRect)
public NSForm(
NSRect aRect,
int anInt,
NSCell aCell,
int anInt,
int anInt)
public NSForm(
NSRect aRect,
int anInt,
Class aClass,
int anInt,
int anInt)
public NSFormCell addEntry(String title)
See Also: insertEntryAtIndex, setEditable (NSCell), setTag (NSActionCell), setTarget (NSActionCell), setAction (NSActionCell), setEnabled (NSActionCell)
public NSCell cellAtIndex(int entryIndex)
See Also: indexOfCellWithTag, indexOfSelectedItem
public void drawCellAtIndex(int entryIndex)
See Also: indexOfCellWithTag, indexOfSelectedItem
public int indexOfCellWithTag(int tag)
See Also: tag (NSCell)
public int indexOfSelectedItem()
public NSFormCell insertEntryAtIndex(
String title,
int entryIndex)
Returns the newly inserted NSFormCell.
See Also: addEntry, removeEntryAtIndex
public void removeEntryAtIndex(int entryIndex)
public void selectTextAtIndex(int entryIndex)
public void setBezeled(boolean flag)
See Also: setBordered, isBezeled (NSCell)
public void setBordered(boolean flag)
See Also: setBezeled, isBordered (NSCell)
public void setEntryWidth(float width)
public void setInterlineSpacing(float spacing)
public void setTextAlignment(int alignment)
NSText.RightTextAlignment
, NSText.CenterTextAlignment
,
or NSText.LeftTextAlignment
(the default).See Also: setTitleAlignment
public void setTextFont(NSFont font)
See Also: setTextFont
public void setTitleAlignment(int alignment)
NSText.RightTextAlignment
, NSText.CenterTextAlignment
,
or the default, NSText.LeftTextAlignment
.See Also: setTextAlignment
public void setTitleFont(NSFont font)
See Also: setTextFont