1
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()
}
}
极简单的代码,但没有文字显示。
窗口中央应该有“hello swt”。
scala.version = 2.9.0-1,SWT:3.7.0-Win32的
SWT文本插件不显示
这就是它!看起来“swt/jface in action”对swt来说太旧了。3.7 – jilen
实际上,它一直是这样的。 :-)这只是SWT(没有默认布局)和JFace(不是)之间的区别。 –