SWT control functions

Source: Internet
Author: User

Control

The control class is the superclass of all the pop-up boxes and form controls, such as button, label, progressbar, Sash, scrollable, and slider (We will describe these controls later in this chapter ). Useful APIs include:

Addcontrollistener adds a listener to the listener set. When the control moves or changes the size, it sends a message defined in the controllistener interface to notify the listener.

Addfocuslistener adds a listener to the listener set. When the request event of the control is triggered, it sends a message defined in the helplistener interface to notify the listener.

Addkeylistener adds a listener to the listener set. When you press the button or release it, it sends a message defined in the keylistener interface to notify the listener.

Addmouselistener adds a listener to the listener set. When you click or release the listener, it sends a message defined in the mouselistener interface to notify the listener.

Addmousemovelistener adds a listener in the listener set. When the mouse moves, it notifies the listener by sending a message defined in the mousemovelistener interface.

Addmousetracklistener (mousetracklistener) adds a listener to the listener set. When the cursor passes or hangs on the control, it sends a message defined in the mousetracklistener interface to notify the listener.

Addpaintlistener adds a listener to the listener set. When the receiver needs to re-draw the listener, it sends a message defined in the paintlistener interface to notify the listener.

Addtraverselistener adds a listener to the listener set. When the Traversal Time is triggered, it sends a message defined in the traverselistener interface to notify the listener.

Getdisplay () returns a display created by the receiver.

Getparent () returns the receiver's parent, which must be of the composite type or null. When the receiver is a form (Shell), its father is the created display or null.

Getshell () returns the receiver's shell.

Isdisposed () returns true if the widget has been released; otherwise, false.

Isenabled () returns true if the receiver and all the recipients are available, otherwise false.

Isvisible () returns true if the receiver and all the recipients are pre-visible; otherwise, false.

Pack () changes the control size to its most appropriate size.

Redraw () redraws the area marker to be redrawn.

Setbackground (color) sets the background color of the receiver to the color specified by the parameter, or the default color of the control. The parameter is null.

Setbounds (rectangle) uses the specified rectangle parameter to set the recipient's size and position.

Setenabled (Boolean): If the parameter is true, the receiver is available; otherwise, the receiver is unavailable.

Boolean setfocus () is the focus of the receiver's keyboard so that all keyboard events can be passed to it.

Setfont (font) uses the specified font parameter to set the recipient's font to draw text information. Or use the null parameter, which uses the default font of the control.

Setlayoutdata (object) uses the specified parameter to set the layout data of the receiver.

Setredraw (Boolean) if the parameter is false, subsequent painting operations will be ignored.

Settooltiptext (string) sets the recipient's prompt information.

Setvisible (Boolean) indicates that the receiver is visible when the parameter is true. Otherwise, the receiver is invisible.

Update () before this method returns, all widget draw requests are forcibly processed.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.