| Home | Contents Next » | Download |
| JRBuilder: Hello World Demo 1 | ||
| The traditional Hello World application, with a File menu. | ![]() |
|
JRBuilder code runs in an instance of
JRBuilder::Context (or you can
write your own Context class).
Code in the
ctx.enter{}
block runs as though it were inside that class.
Component names are resolved by looking in the
Any event handler defined in a
Many common constants can be specified using
The use of
|
require 'jrbuilder'
ctx = JRBuilder.new_swing_context
ctx.enter {
attr_reader :my_frame
@my_frame = frame('Hello World Demo 1') { size 320, 240
content_pane { layout :box,_parent,:Y_AXIS }
on_window_closing { my_frame.dispose }
menu_bar {
menu('File') { mnemonic :VK_F; background :WHITE
menu_item('Exit') { mnemonic :VK_X; background :WHITE
on_click { my_frame.dispose }
}
}
}
y_glue
panel {layout :box,_parent,:X_AXIS; background :WHITE
label('Hello, World!') { foreground :BLUE }
}
y_glue
}
}
ctx.my_frame.show
|
|
| Home | Contents Next » | Download |