001package jmri.jmrix.dcc4pc.swing; 002 003import java.util.ResourceBundle; 004import javax.swing.JMenu; 005import jmri.jmrix.dcc4pc.Dcc4PcSystemConnectionMemo; 006 007/** 008 * Create a "Systems" menu containing the Jmri DCC4PC-specific tools 009 * 010 * @author Kevin Dickerson 011 */ 012public class Dcc4PcMenu extends JMenu { 013 014 public Dcc4PcMenu(Dcc4PcSystemConnectionMemo memo) { 015 super(); 016 017 ResourceBundle rb = ResourceBundle.getBundle("jmri.jmrix.dcc4pc.Dcc4PcBundle"); 018 019 if (memo != null) { 020 setText(memo.getUserName()); 021 } else { 022 setText(rb.getString("MenuDcc4Pc")); 023 } 024 025 jmri.util.swing.WindowInterface wi = new jmri.util.swing.sdi.JmriJFrameInterface(); 026 027 for (Item item : panelItems) { 028 if (item == null) { 029 add(new javax.swing.JSeparator()); 030 } else { 031 add(new Dcc4PcNamedPaneAction(rb.getString(item.name), wi, item.load, memo)); 032 } 033 } 034 035 } 036 037 Item[] panelItems = new Item[]{ 038 new Item("MenuItemDcc4PcMonitor", "jmri.jmrix.dcc4pc.swing.monitor.Dcc4PcMonPane"), 039 new Item("MenuItemSendPacket", "jmri.jmrix.dcc4pc.swing.packetgen.PacketGenPanel"), 040 new Item("MenuItemInfo", "jmri.jmrix.dcc4pc.swing.StatusPanel"), 041 new Item("MenuItemBoardList", "jmri.jmrix.dcc4pc.swing.boardlists.BoardListPanel") 042 043 }; 044 045 static class Item { 046 047 Item(String name, String load) { 048 this.name = name; 049 this.load = load; 050 } 051 052 String name; 053 String load; 054 } 055 056}