jQuery in Action, 3rd edition
The moose likes Swing / AWT / SWT and the fly likes Skinnable ProgressBar and resize mechanism Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Skinnable ProgressBar and resize mechanism" Watch "Skinnable ProgressBar and resize mechanism" New topic

Skinnable ProgressBar and resize mechanism

Arnon Eilat

Joined: Apr 24, 2010
Posts: 2
I'm new here...

I'm building a small skinnable program.

I know I can use the setLookAndFeel() method,
but i want full control over the look of my Components.
For this reason i override the paint method' and paint the Components with images or GradientPaint.

Here is my Skinnable ProgressBar.
Of course, the original code is more complicated, specially the paint method.
To make the code more readable and simple i remove some unnecessary part (more MouseListener, Graphics stuff etc...)

The Problem:
I don't succeed to make the resize() method of the SkinnableProgressBar class work Appropriately,
Which means to make that the indicatorRect Height's will Changes in proportion to the General High.
Can anyone show my how the resize mechanism should work ?

I know that during the resize the ProgressBar jump, but this is not the problem - it's happens because i remove some parts of the code...


Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
perhaps you could add more detail of exactly what should happen when the frame resizes

I tried the code, if I drag the frame bottom lower, the progressbar(?) increases in height
(that's the one on the right, not where it jumps to the left)
Arnon Eilat

Joined: Apr 24, 2010
Posts: 2
the problem is that the indicatorRect(the blue one) is disappear when the frame resize.
the indicatorRect should keep it proportion relative to the size of the frame.
I agree. Here's the link: http://aspose.com/file-tools
subject: Skinnable ProgressBar and resize mechanism
It's not a secret anymore!