站内搜索: 请输入搜索关键词
当前页面: 图书首页 > SWT: The Standard Widget Toolkit

4.5 Z-Order - SWT: The Standard Widget Toolkit

Previous Section  < Day Day Up >  Next Section

4.5 Z-Order

The z-order of a control is the position of the control in the drawing order of its parent.[8] A control that is higher in the drawing order than some other control is said to be above the other control. Similarly, the lower control is said to be below the other control. When one control is above another and the controls overlap, the higher control is drawn on top, obscuring the overlapping part of the other control.

[8] The term z-order refers to the z axis of the standard mathematical XYZ coordinate system used to describe objects in three-dimensional space.

In SWT, the z-order matches the order that controls are stored in the children list of the parent. Controls that are on top occur earlier in the list. When a control is created, it is placed at the end of the children list, below the other siblings.

You can change the z-order of a control using moveAbove() and moveBelow().

moveAbove(Control control) Moves the control that is sent this message above the control that is provided as the parameter. If the parameter is null, the control is moved to the top of the z-order, in front of every other control in the children list of the parent.

moveBelow(Control control) Moves the control that is sent this message below the control that is provided as the parameter. If the parameter is null, the control is moved to the bottom of the z-order, behind every other control in the children list of the parent.

    Previous Section  < Day Day Up >  Next Section