Class: ButtonPanel

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

Overview

Panel containing horizontal row of buttons.

Instance Method Summary collapse

Constructor Details

#initialize(table_model, ancestor_window) ⇒ ButtonPanel

Returns a new instance of ButtonPanel.



144
145
146
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/life_game_viewer/view/life_game_viewer_frame.rb', line 144

def initialize(table_model, ancestor_window)
  super(GridLayout.new(1, 0))
  add(Button.new(ShowFirstGenerationAction, KeyEvent::VK_1, table_model))
  add(Button.new(ShowPreviousGenerationAction, KeyEvent::VK_4, table_model))

  next_button = Button.new(ShowNextGenerationAction, KeyEvent::VK_7, table_model)
  add(next_button)
  ancestor_window.add_window_listener(InitialFocusSettingWindowListener.new(next_button))

  add(Button.new(ShowLastGenerationAction,     KeyEvent::VK_0, table_model))
  add(Button.new(CopyToClipboardAction,        ClipboardHelper.copy_key_name, table_model))
  add(Button.new(NewGameFromClipboardAction,   ClipboardHelper.paste_key_name, table_model))
  add(Button.new(ExitAction,                   KeyEvent::VK_Q, table_model))
end