Class: RSwing::Components::Button
- Includes:
- Component, Events::ButtonEvents
- Defined in:
- lib/rswing/components/button.rb
Overview
Button-Class. Wraps JButton-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
-
#initialize(text, options = {}, &block) ⇒ Button
constructor
-
text: The Text to be displayed on the button.
-
Methods included from Events::FocusEvents
Methods included from Events::InputMethodEvents
Methods included from Events::HierarchyBoundsEvents
Methods included from Events::KeyEvents
Methods included from Events::MouseMotionEvents
Methods included from Events::MouseEvents
Methods included from Events::ComponentEvents
Constructor Details
#initialize(text, options = {}, &block) ⇒ Button
-
text: The Text to be displayed on the button. -
options: Options-Hash with the following valid values:
-
:visible => true -
:enabled => true -
:belongs_to => nil# Container to which this button should be added (default: none) -
:layout => nil# Layout-Options (e.g. GridBagContraints-Object) (default: none) -
:icon => nil# Icon-Symbol to be displayed next to/instead of the text on the button (default: none) -
:name => :okButtonName of the buttons 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/button.rb', line 37 def initialize(text, = {}, &block) super(text) self.visible = Options.value_for( => :visible) self.enabled = Options.value_for( => :enabled) self.icon = Options.value_for( => :icon) # call block with current object, if given if block_given? yield self end unless .empty? Container.add_if_requested(self, ) end end |