예제 #1
0
 private ButtonUI addButton(final MenuItem mi) {
   ButtonUI btnNewButton = new ButtonUI(mi.getLabel());
   final MainMenuUI thisMenu = this;
   add(btnNewButton);
   final String buttonText = "clicked it!" + mi.getLabel();
   btnNewButton.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent arg0) {
           System.out.println(buttonText);
           thisMenu.load(mi.open());
         }
       });
   return btnNewButton;
 }
예제 #2
0
  /** Create the panel. */
  public MainMenuUI(BufferedImage image) {
    // this.setBackground(new Color(0,0,0,0));
    setLayout(new GridLayout(0, 1, 10, 10));
    this.image = image;
    addTitle();
    // ============BEGIN MANUALLY ADDING MENU OPTIONS====================//
    List<MenuItem> options = new ArrayList<MenuItem>();
    for (int i = 0; i < 5; i++) {
      MenuItem newMI = new MenuItem("label" + i);
      newMI.addMenuItem("duummy" + i);
      newMI.addTextInput("type here" + i);
      options.add(newMI);
    }
    // ============END   MANUALLY ADDING MENU OPTIONS====================//

    fillButtons(options);
  }