Class: Java::javafx::stage::Stage
- Inherits:
-
Object
- Object
- Java::javafx::stage::Stage
- Includes:
- JRubyFX::DSL
- Defined in:
- lib/jrubyfx/core_ext/stage.rb
Overview
JRubyFX DSL extensions for the JavaFX Stage
Constant Summary
Constants included from JRubyFX::DSL
JRubyFX::DSL::ENUM_OVERRIDES, JRubyFX::DSL::NAME_TO_CLASSES
Constants included from JRubyFX
Constants included from JRubyFX::FXImports
JRubyFX::FXImports::JFX_CLASS_HIERARCHY
Instance Method Summary collapse
-
#[](name) ⇒ Object
call-seq: [name] => node or nil Returns the item in the scene with the given CSS selector, or nil if not found.
-
#layout_scene(*args, &code) ⇒ Object
call-seq: layout_scene() { block } => scene layout_scene(fill) { block } => scene layout_scene(width, height) { block } => scene layout_scene(width, height, fill) { block } => scene layout_scene(width, height, depth_buffer) { block } => scene layout_scene(hash) { block } => scene layout_scene(fill, hash) { block } => scene layout_scene(width, height, hash) { block } => scene layout_scene(width, height, fill, hash) { block } => scene layout_scene(width, height, depth_buffer, hash) { block } => scene layout_scene(fill, hash) => scene layout_scene(width, height, hash) => scene layout_scene(width, height, fill, hash) => scene layout_scene(width, height, depth_buffer, hash) => scene layout_scene(fill) => scene layout_scene(width, height) => scene layout_scene(width, height, fill) => scene layout_scene(width, height, depth_buffer) => scene.
Methods included from JRubyFX::DSL
included, inject_enum_method_converter, inject_symbol_converter, load_dsl, load_enum_converter, #method_missing
Methods included from JRubyFX
Methods included from JRubyFX::Utils::CommonUtils
#attempt_conversion, #populate_properties, #split_args_from_properties
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class JRubyFX::DSL
Instance Method Details
#[](name) ⇒ Object
call-seq:
[name] => node or nil
Returns the item in the scene with the given CSS selector, or nil if not found.
Example
stage['#my_button'] #=> Button
stage['#doesNotExist'] #=> nil
32 33 34 |
# File 'lib/jrubyfx/core_ext/stage.rb', line 32 def [](name) get_scene.lookup(name) end |
#layout_scene(*args, &code) ⇒ Object
call-seq:
layout_scene() { block } => scene
layout_scene(fill) { block } => scene
layout_scene(width, height) { block } => scene
layout_scene(width, height, fill) { block } => scene
layout_scene(width, height, depth_buffer) { block } => scene
layout_scene(hash) { block } => scene
layout_scene(fill, hash) { block } => scene
layout_scene(width, height, hash) { block } => scene
layout_scene(width, height, fill, hash) { block } => scene
layout_scene(width, height, depth_buffer, hash) { block } => scene
layout_scene(fill, hash) => scene
layout_scene(width, height, hash) => scene
layout_scene(width, height, fill, hash) => scene
layout_scene(width, height, depth_buffer, hash) => scene
layout_scene(fill) => scene
layout_scene(width, height) => scene
layout_scene(width, height, fill) => scene
layout_scene(width, height, depth_buffer) => scene
Creates a new scene with given constructor arguments (fill, width, height), sets all the properties in the hash, and calls the block on the scene.
Examples
layout_scene(fill: "white") do
label("Hello World!")
end
layout_scene(:white) do
label("Hello World!")
end
layout_scene do
fill = Color::WHITE
label("Hello World!")
end
73 74 75 76 |
# File 'lib/jrubyfx/core_ext/stage.rb', line 73 def layout_scene(*args, &code) root = code.arity == 1 ? code[node] : instance_eval(&code) build(Scene, root, *args).tap { |scene| set_scene scene } end |