I'm looking to create a Bar Chart applet,I did that by drawing rectangles,but the problem is I need to create an event when I click on each bar,but the bars are not objects ,they are just shapes. Any one please can help and tell me how to create a Bar Chart applet and when you click on each bar we popup a menu. Thanks alot.
I suggest that you make lightweight components. Each component can inherit Canvas or Component. Set their size to be the size of the rectangle you want. Set their background color to the color you want. Then place them on a panel using the null layout manager (so you can get exact positioning). Now, each bar has it's own collection of events that it will generate!
I'm not quite sure creating each comp. for every chart is that great idea, since it can slow the whole down a lot (depends on how many charts are there). Why just not check coordinates from the mouse clicks that are going to root component ? From the other side, for the popup menu it can be more complicated, since if popup menu differes for every chart, then you'll need to remove/add items each time you click the popupTrigger button.
------------------ With best of best regards, Pawel S. Veselov ( aka Black Angel )
With best of best regards, Pawel S. Veselov ( aka Black Angel )
I carry this gun in case a vending machine doesn't give me my fritos. This gun and this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!