Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Gradient color JProgressBar  RSS feed

 
Hesham Gneady
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ranchers ,

Is there a way i can make a gradient color JProgressBar to appear stylish with 2 colors.
It would be nice if someone can give me a sample code.

Thanks ,
Hesham
 
Miklos Szeles
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you can create a subclass of JProgressBar then you can override paintComponent in which you can set the Graphic2D's paint to a GradientPaint(with setPaint) then you call the superclass's paintComponent. I don't know if this solution works, but it sounds good. I found it here
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!