Class: Java::JavaAwt::Container

Inherits:
Object
  • Object
show all
Includes:
Sweet::Component
Defined in:
lib/sweet/swing/component.rb

Overview

This is the only base class of ALL Swing components

Instance Attribute Summary

Attributes included from Sweet::Component

#app

Instance Method Summary collapse

Methods included from Sweet::Component

#append, included, #meta, #method_missing, #options=, #perform, #sweeten

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Sweet::Component

Instance Method Details

#awtObject



20
21
22
# File 'lib/sweet/swing/component.rb', line 20

def awt
  java.awt
end

#layout=(value, opts = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/sweet/swing/component.rb', line 6

def layout=(value, opts = {})
  Sweet.debug "layout = #{name}(#{opts.inspect})"
  layout = "#{value.to_s.capitalize}Layout" if value.is_a?(Symbol)
  layout = instance_eval("awt.#{layout}") unless value.is_a?(Class)

  l = layout.new
  opts.each_pair do |k,v|
    l.send("#{k}=", v)
  end

  content_pane.setLayout l
  Sweet.debug content_pane.getLayout
end