Exemplo n.º 1
0
 @SuppressWarnings("deprecation")
 public void addItem(MenuItem item) {
   // the current awt way of adding a separator appears to be adding an item with "-" as the label
   if ("-".equals(item.getLabel())) {
     addSeparator();
   } else {
     item.addNotify();
     jComponent.add(((SwingBaseMenuItemPeer<?, ?>) item.getPeer()).jComponent);
   }
 }
Exemplo n.º 2
0
 @SuppressWarnings("deprecation")
 public SwingMenuPeer(SwingToolkit toolkit, Menu menu) {
   super(toolkit, menu, new JMenu());
   int item_count = menu.getItemCount();
   for (int i = 0; i < item_count; i++) {
     MenuItem menu_item = menu.getItem(i);
     menu_item.addNotify();
     jComponent.add(((SwingMenuComponentPeer<?, ?>) menu_item.getPeer()).jComponent);
   }
 }