• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Bar Chart

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Trailboss
Posts: 23778
IntelliJ IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 )
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic