3

I am making a java game that has a sidebar that displays a player's health. I want the bar to be like a progress bar which is along the lines of the picture below:

enter image description here

Would a progress bar be capable enough to accomplish this? If not, what will?

mKorbel
  • 109,525
  • 20
  • 134
  • 319
Anonymous181
  • 1,863
  • 6
  • 24
  • 27
  • 2
    I dont know enough about the project, but I assume there may be some graphical elements. If there are then it should be simple enough to just draw two rectanges on top of each other and set the top one to be some percentage of the width of the bottom one. – Justin May 06 '12 at 05:11

1 Answers1

4

If you want an "official" answer, then yes, a JProgressBar can do this easily. I suggest that you give it a try and let us know how it works out, especially if you have any problems with it.

Hovercraft Full Of Eels
  • 283,665
  • 25
  • 256
  • 373
  • 1
    +1 `JProgressBar` leverages the look & feel; also consider a custom [`ProgressBarUI`](http://stackoverflow.com/a/8886795/230513) or a [`ProgressIcon`](http://stackoverflow.com/a/3484251/230513). – trashgod May 06 '12 at 07:43