• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 4. Control Fundamentals > Enabling and Disabling

4.6. Enabling and Disabling

Every control has an associated property called its enabled state. A control whose enabled state is false is said to be disabled, and the act of setting the enabled state to false is called disabling the control. A control whose enabled state is true is said to be enabled, and the act of setting the enabled state to true is called enabling the control. When a control is enabled, it responds to mouse clicks, takes focus, and handles key presses. A disabled control is unresponsive to events and typically draws using a “grayed” look. When a parent control is disabled, all children of the control will behave as though they are disabled.

setEnabled(boolean enabled) Enables or disables the control, depending on the boolean argument.

getEnabled() Returns true if the control is enabled and false if it is disabled.

isEnabled() Returns true if the control and all ancestors are enabled, or false if it or any of its ancestors is disabled.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint