Class: Swing::JButton

Inherits:
Object
  • Object
show all
Defined in:
lib/swing/j_button.rb,
lib/swing/old/button.rb

Instance Method Summary collapse

Constructor Details

#initialize(text, opts = {}, &block) ⇒ JButton

Returns a new instance of JButton.



10
11
12
13
14
15
16
# File 'lib/swing/old/button.rb', line 10

def initialize text, opts = {}, &block
  set_attributes(opts) { super(text) }

  self.addActionListener ActionListener.new &block

  opts[:parent].add self if opts[:parent]
end

Instance Method Details

#add_block_listener(&block) ⇒ Object



5
6
7
# File 'lib/swing/j_button.rb', line 5

def add_block_listener &block
  self.addActionListener SwingSupport::ActionListener.new &block
end