Class: AboutFrame

Inherits:
Frame
  • Object
show all
Defined in:
lib/templates/about/about_ui.rb

Constant Summary collapse

FRAME_WIDTH =
600
FRAME_HEIGHT =
130
LABEL_WIDTH =
400
LABEL_HEIGHT =
60

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ AboutFrame

Returns a new instance of AboutFrame.



15
16
17
18
19
20
# File 'lib/templates/about/about_ui.rb', line 15

def initialize *args
  super
  self.minimum_width  = FRAME_WIDTH
  self.minimum_height = FRAME_HEIGHT
  set_up_components
end

Instance Attribute Details

#about_menuObject

Make sure our components are available!



13
14
15
# File 'lib/templates/about/about_ui.rb', line 13

def about_menu
  @about_menu
end

#default_buttonObject

Make sure our components are available!



13
14
15
# File 'lib/templates/about/about_ui.rb', line 13

def default_button
  @default_button
end

#default_labelObject

Make sure our components are available!



13
14
15
# File 'lib/templates/about/about_ui.rb', line 13

def default_label
  @default_label
end

#exit_menuObject

Make sure our components are available!



13
14
15
# File 'lib/templates/about/about_ui.rb', line 13

def exit_menu
  @exit_menu
end

Make sure our components are available!



13
14
15
# File 'lib/templates/about/about_ui.rb', line 13

def menu_bar
  @menu_bar
end

Instance Method Details

#set_up_componentsObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/templates/about/about_ui.rb', line 22

def set_up_components
  component_panel = Panel.new

  # If we were clever we would define a method that took a  single hex value, like CSS.
  component_panel.background_color 255, 255, 255
  component_panel.size FRAME_WIDTH, FRAME_HEIGHT

  # This code uses the MiG layout manager.
  # To learn more about MiGLayout, see:
  #     http://www.miglayout.com/
  component_panel.layout = Java::net::miginfocom::swing::MigLayout.new("wrap 2")

  @default_label = Label.new do |l|
    # A nicer way to set fonts would be welcome
    l.font = java::awt.Font.new "Lucida Grande", 0, 18
    l.minimum_dimensions LABEL_WIDTH, LABEL_HEIGHT
    l.text = "ABOUT: Neurogami::SwingSet rulez!"
  end

  # Add components to panel
  component_panel.add @default_label, "gap unrelated"
  add component_panel
end