Class: Button

Inherits:
JButton
  • Object
show all
Defined in:
lib/life_game_viewer/view/life_game_viewer_frame.rb

Overview

Subclassed by application buttons, contains their common functionality added to the Swing JButton class.

Instance Method Summary collapse

Constructor Details

#initialize(action_class, keystroke_text, table_model) ⇒ Button

Returns a new instance of Button.



132
133
134
135
136
137
138
# File 'lib/life_game_viewer/view/life_game_viewer_frame.rb', line 132

def initialize(action_class, keystroke_text, table_model)
  action = action_class.send(:new, table_model)
  super(action)
  key = KeyStroke.getKeyStroke(keystroke_text)
  get_input_map(JComponent::WHEN_IN_FOCUSED_WINDOW).put(key, keystroke_text)
  get_action_map.put(keystroke_text, action)
end