Share via


Overview | Methods | Fields | This Package | All Packages

OverviewMethodsFieldsThis PackageAll Packages

Control.focus

Attempts to set the focus to this control and activate the form that contains this control, and returns a boolean value indicating whether the attempt succeeded.

Syntax

public final boolean focus()

Return Value

Returns true if the focus is successfully set to this control; otherwise, returns false.

Remarks

Use the canFocus method to determine whether a control can receive the focus. Using the setActiveControl method is a more robust way than using the focus method to set the active control on a form because it does not activate inactive forms.