Class: RSwing::Components::CheckBox

Inherits:
JCheckBox
  • Object
show all
Includes:
Component, Events::ButtonEvents
Defined in:
lib/rswing/components/check_box.rb

Overview

CheckBox-Class. Wraps JCheckBox-Class.

Constant Summary

Constants included from Events::ButtonEvents

Events::ButtonEvents::ActionListener, Events::ButtonEvents::ChangeListener, Events::ButtonEvents::ItemListener

Constants included from Events::FocusEvents

Events::FocusEvents::FocusListener

Constants included from Events::PropertyChanged

Events::PropertyChanged::PropertyChangeListener

Constants included from Events::InputMethodEvents

Events::InputMethodEvents::InputMethodListener

Constants included from Events::HierarchyBoundsEvents

Events::HierarchyBoundsEvents::HierarchyBoundsListener

Constants included from Events::KeyEvents

Events::KeyEvents::KeyListener

Constants included from Events::MouseWheelEvents

Events::MouseWheelEvents::MouseWheelListener

Constants included from Events::MouseMotionEvents

Events::MouseMotionEvents::MouseMotionListener

Constants included from Events::MouseEvents

Events::MouseEvents::MouseListener

Constants included from Events::ComponentEvents

Events::ComponentEvents::ComponentListener

Instance Method Summary collapse

Methods included from Events::FocusEvents

event_mappings

Methods included from Events::InputMethodEvents

event_mappings

Methods included from Events::HierarchyBoundsEvents

event_mappings

Methods included from Events::KeyEvents

event_mappings

Methods included from Events::MouseMotionEvents

event_mappings

Methods included from Events::MouseEvents

event_mappings

Methods included from Events::ComponentEvents

event_mappings

Constructor Details

#initialize(text, options = {}, &block) ⇒ CheckBox

  • text: The Text to be displayed on the checkbox.

  • options: Options-Hash with the following valid values:

  1. :visible => true

  2. :enabled => true

  3. :selected => true # (default: false)

  4. :layout => nil # Layout-Options (e.g. GridBagContraints-Object) (default: none)

  5. :icon => nil # Icon-Symbol to be displayed next to/instead of the text on the checkbox (default: none)

  6. :name => :check_box Name of the checkbox for access via parent-container (default: none)



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/rswing/components/check_box.rb', line 37

def initialize(text, options = {}, &block)
  super(text, Options.value_for(options => :selected))
  
  self.visible = Options.value_for(options => :visible)
  self.enabled = Options.value_for(options => :enabled)
  self.icon = Options.value_for(options => :icon)

  # call block with current object, if given
  if block_given?
    yield self
  end
  
  unless options.empty?
    Container.add_if_requested(self, options)
  end
end