I'm trying to have "Hello SWT" show up in the center of a window in SWT, but nothing is showing.
Here is my simple code (scala.version=2.9.0-1, swt:3.7.0-win32):
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()
}
}
Add this line after creating your shell:
shell.setLayout(new FillLayout)