Developer Documentation
PATH  Mac OS X Documentation > Application Kit Reference: Java


[Previous] [Class List] [Next]

NSFormCell


Inherits from: NSActionCell : NSCell : NSObject
Package: com.apple.yellow.application


Class Description


This class is used to implement text entry fields in an NSForm. The left part of an NSFormCell is a title. The right part is an editable text entry field.

For more on the use of NSFormCell, see the class specification for NSForm.


Method Types


Initializing an NSFormCell
initTextCell:
Asking about a cell's appearance
isOpaque
Asking about a cell's title
attributedTitle
title
titleAlignment
titleFont
titleWidth
Changing the cell's title
setAttributedTitle
setTitle
setTitleAlignment
setTitleFont
setTitleWidth
Setting a keyboard equivalent
setTitleWithMnemonic

Constructors


NSFormCell

public NSFormCell(String aString)

Creates a newly allocated NSFormCell. Its title is set to aString. The contents of its text entry field are set to the empty string (""). The font for both title and text is the user's chosen system font in 12.0 point, and the text area is drawn with a bezel.

public NSFormCell(NSImage anImage)

<<Documentation Forthcoming>>

Instance Methods



attributedTitle

public NSAttributedString attributedTitle()

Returns the title as an attributed string.

isOpaque

public boolean isOpaque()

Returns true if both the title and the entry field are opaque, false if one or both of them are transparent. Because titles are transparent by default, this method usually returns false.

setAttributedTitle

public void setAttributedTitle( NSAttributedString aNSAttributedString)

Sets the cell's title and title attributes according to anAttributedString.

setTitle

public void setTitle( String aString)

Sets the cell's title to aString.

setTitleAlignment

public void setTitleAlignment( int alignment)

Sets the alignment of the title. alignment can be one of three constants: NSText.LeftTextAlignment, NSText.RightTextAlignment, or NSText.CenterTextAlignment.

setTitleFont

public void setTitleFont( NSFont font)

Sets the title's font.

setTitleWidth

public void setTitleWidth( float width)

Sets the width in pixels. You usually won't need to to invoke this method, because the Application Kit automatically sets the title width whenever the title changes. If, however, the automatic width doesn't suit your needs, you can use setTitleWidth to set the width explicitly.

Once you have set the width this way, the Application Kit stops setting the width automatically; you will need to invoke setTitleWidth every time the title changes. If you want the Application Kit to resume automatic width assignments, invoke setTitleWidth with a negative width value.



setTitleWithMnemonic

public void setTitleWithMnemonic( String titleWithAmpersand)

Sets the cell title and a single mnemonic character. The mnemonic character, which follows the ampersand in titleWithAmpersand, serves as an Alt-key equivalent to clicking in the text entry field.

For example, if titleWithAmpersand is "T&itle," the cell's title will be displayed as "Title" (the mnemonic character, i, is underlined). If a user types Alt-i, it will have the same effect as clicking in the text entry field.

See Also: setTitle



title

public String title()

Returns the cell's title. The default title is "Field:".

titleAlignment

public int titleAlignment()

Returns the alignment of the title. The alignment can be one of the following: NSText.LeftTextAlignment, NSText.CenterTextAlignment, or NSText.RightTextAlignment (the default).

titleFont

public NSFont titleFont()

Returns the font used to draw the cell's title.

titleWidth

public float titleWidth()

Returns the width (in pixels) of the title field. If you specified the width using setTitleWidth, this method returns the value you chose. Otherwise, it returns the width calculated automatically by the Application Kit.

See Also: titleWidthWithSize



titleWidthWithSize

public float titleWidthWithSize( NSSize aSize)

Returns the width (in pixels) of the title field. If you specified the width using setTitleWidth, this method returns the value you chose Otherwise, it calculates the width, constrained to aSize.

See Also: titleWidth




[Previous] [Next]