Eclipse SWT最新的版本中org.eclipse.swt.widgets.Control增加了一个新方法requestLayout()用于更高效的处理layout请求
该方法其实只有一行代码:
public void requestLayout () {
getShell ().layout (new Control[] {this}, SWT.DEFER);
}
这是SWT当前最高效的触发layout的办法,但是目前大多数开发者还是习惯使用性能更差的 Composite.layout()方法,
下面是说明原文:
SWT has added a new requestLayout() method to the Control and Composite classes. This method does essentially the same thing as
widget.getShell().layout(new Control[] {widget}, SWT.DEFER);
The snippet, above, is currently the most efficient method of triggering layouts in SWT, but most developers are unaware of this. Most Eclipse developers invoke Composite.layout(), which is worse in the sense of performance. This new API is intended to make it easier for developers to adopt the more efficient mechanism as opposed to using Composite#layout().However, be aware that changing existing invocations of layout() to requestLayout() may break code that assumes that controls are completely sized and positioned at a certain point in time.
参考
《Eclipse Project Neon (4.6) M4 - New and Noteworthy》
《http://www.vogella.com/tutorials/SWT/article.html》

Eclipse SWT 最新版本中引入了 requestLayout() 方法,该方法被添加到 Control 和 Composite 类中,用于高效地触发布局更新。此方法相较于常用的 Composite.layout() 提供了更好的性能表现,有助于改善应用程序的响应速度。
168

被折叠的 条评论
为什么被折叠?



