Sha256: 505013b0ddb1c7c58edae78fc59915312650efebb47506118309baf99b7477b6
Contents?: true
Size: 902 Bytes
Versions: 1
Compression:
Stored size: 902 Bytes
Contents
require 'swing/menu' require 'swing/menu_item' require 'swing/attr_setter' module Clients module Swing class MenuBar < javax.swing.JMenuBar include AttrSetter def initialize opts = {} set_attributes(opts) { super() } if opts[:structure] [opts[:structure]].flatten.each do |element| case element when Hash # Hash defines menu structure element.each do |menu_name, menu_structure| menu = Menu.new menu_name.to_s, :parent => self menu_structure.each do |item_name, item_action| MenuItem.new item_name.to_s, :parent => menu, &item_action end end else self.add element end end end opts[:parent].setJMenuBar self if opts[:parent] end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
swing-0.0.2 | lib/swing/menu_bar.rb |