Sha256: aa0b76712d7355cb320be74642f2322cd41af7f12418bc310043bf38db49e816
Contents?: true
Size: 810 Bytes
Versions: 2
Compression:
Stored size: 810 Bytes
Contents
require 'swing' require 'swing/j_menu' require 'swing/j_menu_item' class Swing::JMenuBar def initialize opts = {} super opts 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 = JMenu.new menu_name.to_s, :parent => self menu_structure.each do |item_name, item_action| JMenuItem.new item_name.to_s, :parent => menu, &item_action end end else self.add element end end end end # Post-processing (non-setter) options given to initialize def self.add_component component, parent parent.setJMenuBar component if parent end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
swing-0.1.2 | lib/swing/j_menu_bar.rb |
swing-0.1.1 | lib/swing/j_menu_bar.rb |