[英]SWT Text widget does not show up
package org.jilen.editor
import org.eclipse.swt.widgets.Display
import org.eclipse.swt.widgets.Shell
import org.eclipse.swt.widgets.Text
import org.eclipse.swt.SWT
object EditorApp {
def main(args: Array[String]) {
val display = new Display()
val shell = new Shell(display)
val text = new Text(shell, SWT.CENTER)
text.setText("Hello SWT")
shell.pack()
shell.open()
while (!shell.isDisposed) {
if (!display.readAndDispatch) {
display.sleep()
}
}
display.dispose()
}
}
extremely simple code, but no text is show.非常简单的代码,但没有显示文本。
The window should have "hello swt" in the center. window 的中心应该有“hello swt”。
scala.version=2.9.0-1, swt:3.7.0-win32 scala.version=2.9.0-1, swt:3.7.0-win32
Add this line after creating your shell:在创建 shell 后添加此行:
shell.setLayout(new FillLayout)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.