my dog learned polymorphism*
The moose likes Beginning Java and the fly likes concatenation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "concatenation" Watch "concatenation" New topic
Author

concatenation

bibsie kau
Greenhorn

Joined: Jan 31, 2005
Posts: 2
hi
i have a for loop, in wich im creating a submenu dynamically.

how do i make the values of this menu unique?

HoverMenuItem instance need to be unique.
I thought of doing this:
HoverMenuItem itemDept = itemSubDept.addMenuItem("dept", value);

for(int i=0; i< reslist.size(); i++){
value = reslist.get(i).toString();
HoverMenuItem itemDept = itemSubDept.addMenuItem("dept", value);
}
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

OK, so you thought of doing that... does that work? What happens? What do you want to happen instead? And what is a HoverMenuItem, and does that matter?


[Jess in Action][AskingGoodQuestions]
Priyaa V Kumar
Ranch Hand

Joined: Aug 12, 2004
Posts: 32
You can add the value of loop variable to the menuitem's name



The menuitems would be created with names dept0, dept1 and so on.

Hope this helps.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: concatenation