Class: SwingParadise::QuitButtonExample

Inherits:
JFrame
  • Object
show all
Includes:
SwingParadise
Defined in:
lib/swing_paradise/examples/001_quit_button_example.rb

Constant Summary

Constants included from SwingParadise

LAST_UDPATE, VERSION

Instance Method Summary collapse

Methods included from SwingParadise

#jcombobox, #jframe, #jruby_font, #jtextview, #quit_button, remove_html, #show_message_dialog, #swing_dimension, text, #text

Constructor Details

#initialize(run_already = true) ⇒ QuitButtonExample

#

initialize

#


25
26
27
28
29
# File 'lib/swing_paradise/examples/001_quit_button_example.rb', line 25

def initialize(
    run_already = true
  )
  run if run_already
end

Instance Method Details

#runObject

#

run

#


34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/swing_paradise/examples/001_quit_button_example.rb', line 34

def run
  frame = frame('A quit button example')
  panel = JPanel.new # This is an instance of Java::JavaxSwing::JPanel.
  panel.set_font(Font.new 'Sans serif', Font::PLAIN, 25)
  frame.getContentPane.add(panel)
  panel.setLayout(nil)
  panel.hint = 'A quit button example'
  _ = quit_button
  _.set_bounds(10, 20, 200, 40)
  panel << _
  frame.exit_on_close
  frame.set_size(500, 400)
  frame.setLocationRelativeTo(nil)
  frame.show_all
end