Sha256: 884291b6ee4a46e3a1de8f46acbaf133d11bc03b259c565ab567bee8f562bbea

Contents?: true

Size: 884 Bytes

Versions: 5

Compression:

Stored size: 884 Bytes

Contents

include Java

require 'rubygems'
require "rubeus"

class Example01
  extend Rubeus::Swing
  
  def show
    JFrame.new("Rubeus Swing Example 01") do |frame|
      frame.layout = BoxLayout.new(:Y_AXIS)
      JSplitPane.new(JSplitPane::VERTICAL_SPLIT) do
        JPanel.new do |panel|
          panel.layout = BoxLayout.new(:X_AXIS)
          @text_field = JTextField.new do |event|
            if event.key_code == 10 # RETURN
              @textpane.text += @text_field.text + "\n"
              @text_field.text = ''
            end
          end
          JButton.new("append") do
            @textpane.text += @text_field.text + "\n"
            @text_field.text = ''
          end
        end
        JScrollPane.new(:preferred_size => [400, 250]) do |pane|
          @textpane = JTextPane.new
        end
      end
      frame.visible = true
    end
  end
end
Example01.new.show

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rubeus-0.0.8-java examples/rubeus_swing_example01_with_class.rb
rubeus-0.0.5-java examples/rubeus_swing_example01_with_class.rb
rubeus-0.0.4-java examples/rubeus_swing_example01_with_class.rb
rubeus-0.0.6-java examples/rubeus_swing_example01_with_class.rb
rubeus-0.0.7-java examples/rubeus_swing_example01_with_class.rb