Skip to content

Instantly share code, notes, and snippets.

@Swind
Created September 13, 2011 00:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Swind/1212840 to your computer and use it in GitHub Desktop.
Save Swind/1212840 to your computer and use it in GitHub Desktop.
[Scala][SWT][GUI] SWT使用WebKit核心的範例
package example.swt
import org.eclipse.swt.widgets.{Shell, Display}
import org.eclipse.swt.layout.FillLayout
import org.eclipse.swt.browser.Browser
import org.eclipse.swt.SWT
/**
* Date: 2011/9/2
* Time: 上午 8:20
*/
object WebKitInABrowser {
def main(args: Array[String]) {
val display = new Display
val shell = new Shell(display)
shell setLayout(new FillLayout)
shell setText "WebKit"
val browser = new Browser(shell,SWT.NONE)
shell open()
browser.setUrl("http://webkit.org")
while(!shell.isDisposed){
if(!display.readAndDispatch())
display.sleep()
}
display.dispose()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment