Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "JRuby/SWTSnippets/Snippet1.rb"
< JRuby | SWTSnippets
m (JRuby/SWTSnippets/1 moved to JRuby/SWTSnippets/Snippet1.rb) |
|||
Line 12: | Line 12: | ||
shell = Shell.new(display) | shell = Shell.new(display) | ||
shell.open | shell.open | ||
− | while !shell.isDisposed | + | |
− | + | display.sleep unless display.readAndDispatch until shell.isDisposed | |
− | + | ||
− | + | # the above is the short form of: | |
− | + | # while !shell.isDisposed | |
− | + | # if !display.readAndDispatch | |
+ | # display.sleep | ||
+ | # end | ||
+ | # end | ||
+ | |||
display.dispose | display.dispose | ||
end | end |
Revision as of 01:40, 28 July 2009
require 'java' # # example snippet: Hello World # class Snippet1 include_package 'org.eclipse.swt.widgets' def Snippet1.main display = Display.new shell = Shell.new(display) shell.open display.sleep unless display.readAndDispatch until shell.isDisposed # the above is the short form of: # while !shell.isDisposed # if !display.readAndDispatch # display.sleep # end # end display.dispose end end Snippet1.main