Sha256: c730c0f6c67353a41862780f1d401828ff5154b86c82f4328108707c508a16ae

Contents?: true

Size: 1.68 KB

Versions: 3

Compression:

Stored size: 1.68 KB

Contents

== RSwing - Swing wrapper for JRuby

RSwing is licensed under the GNU LGPL v3. For more information, take a look at
the LICENSE file.

================================================================================

RSwing is a wrapper of the Swing GUI-Framework of the Java Platform for JRuby.
The goal is to provide a ruby-ish wrapper library to Swing, which makes it feel
more like an actual ruby library rather than just a plain interface to the java
classes.

For example, RSwing tries to make heavy use of blocks, symbols and similar 
typical ruby concepts.

================================================================================

Some examples:

  Frame.new("hello, world") do |frame|
    frame.default_close_operation = :exit_on_close
    frame.size = java.awt.Dimension.new(200,200)

    # create a new button, belonging to this frame with a given name to access it easily later
    Button.new("OK", :belongs_to => frame, :name => :okButton) do |btn|

      btn.on_click do
        Dialog.show frame, "Button clicked!", :dialog_type => :info, :title => "My Title"
      end

      btn.on_focus do
        puts "button has now focus"
      end

      btn.on_focus_lost do
        puts "button has lost focus"
      end
    end

    # accessing components of frame via :name attribute given to button:
    puts "text property of : #{frame[:okButton].text}"

    # options-dialog
    options = ["Yes", "No", "Cancel"]
    selected_value = Dialog.showOption(frame, options.join(" or ") + "?",
                                        :option_values => options, 
                                        :option_type => :yes_no_cancel)

    puts "#{selected_value} was selected"

    frame.visible = true
  end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bakkdoor-rswing-0.1.0 README
bakkdoor-rswing-0.1.1 README
bakkdoor-rswing-0.1.2 README