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
Line 29: | Line 29: | ||
display.sleep unless display.readAndDispatch until shell.isDisposed | display.sleep unless display.readAndDispatch until shell.isDisposed | ||
− | # the line above | + | # the line above spins the event loop; it's the short form of: |
# while !shell.isDisposed | # while !shell.isDisposed | ||
# if !display.readAndDispatch | # if !display.readAndDispatch |
Latest revision as of 08:24, 28 July 2009
################################################################################ # Copyright (c) 2009 IBM Corporation and others. # All rights reserved. This program and the accompanying materials # are made available under the terms of the Eclipse Public License v1.0 # which accompanies this distribution, and is available at # http://www.eclipse.org/legal/epl-v10.html # # Contributors: # IBM Corporation - initial API and implementation ################################################################################ require 'java' # # example snippet: Hello World # # For a list of SWT example snippets ported to JRuby, see # http://wiki.eclipse.org/JRuby/SWTSnippets # 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 line above spins the event loop; it's the short form of: # while !shell.isDisposed # if !display.readAndDispatch # display.sleep # end # end display.dispose end end Snippet1.main
Compare with the Java version.