This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
Project - the root folder
subfolders - under project folder
endfolders - under subfolders folder
i created dynamic JMenus(initialize in the constructor) from a subfolders of Project(this is the root folder), i made it dynamically because the folders are not permanent, it could be deleted, and also under subfolders is i created a JMenuItem which are the endfolders, now i am confused on how to add an actionlistener to the JMenu/JMenuItem because the initialization of the components are in my constructor,
that is how i initialize the JMenu dynamically, my problem is how to add an action listener to that style.
hi maneesh, i tried your code but nothing happened after i click the submenu's. is there something i missed? it runs smoothly but no actionperformed happened.
Runs smoothly? No actionPerformed? What do you mean by runs smoothly then?
Impossible to say whats going wrong at your end without seeing the code.
Post some SSCCE which demonstrates the problem and which we can try out on our machines.
@maneesh: i mean it run before, without the actionperformed, after i insert the code, it still run but no action when i click the JMenu, and yes i will post the code snippet but i have to make another because the original code is very long.. i will just make it short, regarding only to the topic..
@michael: it can be but theres an endfolders after subfolders, i will just show you the code..
Like Maneesh suggested I create a custom action (SomeAction). In it's implementation you'd have to insert logic (what to do for different subfolders/menu items).
Censorship is the younger of two shameful sisters, the older one bears the name inquisition. -- Johann Nepomuk Nestroy
Roldan Baldo
Ranch Hand
Joined: Aug 11, 2009
Posts: 99
posted
0
yes, i know now where i get stuck, because i put an action to a JMenu, instead that action will be on a JMenuItem i wrote the action now in a JMenuItem and it works.
thanks maneesh for the code snippet, peter and michael.. it solves my problem