Skip to content
This repository has been archived by the owner on Jul 10, 2018. It is now read-only.

JProgressBar doesn't render properly off-screen #36

Closed
ghost opened this issue Jul 25, 2017 · 4 comments
Closed

JProgressBar doesn't render properly off-screen #36

ghost opened this issue Jul 25, 2017 · 4 comments

Comments

@ghost
Copy link

ghost commented Jul 25, 2017

I've been working on a simple library to render Swing components for use as OpenGL textures via JOGL and using Substance as the Look and Feel for a larger application.

Basically, I'm using JComponent instances of various types and taking snapshots of them via their paint(Graphics) methods.

When I do so with Substance's Graphite Look and Feel (this is the only Substance theme I've tested with) installed as the default, JProgressBar doesn't display it's progress indicator (the bar itself that moves as things...progress), unless I place it in an un-displayed JFrame and call that frame's pack() method. If I don't call pack(), then the indicator works, but shows the wrong value.

Oddly, thereafter, it would seem that the progress indicator won't move again.

This kind of off-screen rendering seems to work just fine for the Metal Look and Feel with no trouble.

I've attached a couple of screenshots, as rendered by JOGL through my library, to show the difference between the failed version and the works only once version.

substance - failed jprogressbar
substance - working jprogressbar

@ghost
Copy link
Author

ghost commented Jul 25, 2017

Hrm. I just found a work-around that does away with the JFrame and gets it to update properly, but am unsure of the consequences.

If I call updateUI() on the JProgressBar after each change of value, it works, Not sure why. Can't say I'm overly familiar with how that method works.

@kirill-grouchnikov
Copy link
Owner

Since this is not the "primary intended" usage of this library, I would need to see a small, standalone and complete sample that reproduces this issue under the latest dev builds.

Note that the simpler the setup is, the higher the chances are that I'll get to carve out a chunk of time to take a look at it. There are a lot of moving pieces at play in the Swing rendering pipeline, and without being able to reproduce this issue I can't tell where exactly it fails.

@ghost
Copy link
Author

ghost commented Jul 25, 2017

Okay. That's going to take some time to put together.

My current project is not really stand-alone, nor is it small, but my thinking is I can reproduce this bug in a more compact form by painting to a BufferedImage and then displaying that on-screen in a more regular fashion.

So, gimme a few hours. Maybe a day.

@ghost
Copy link
Author

ghost commented Jul 25, 2017

All-right, got that done. The attached file should have everything you need to demo this yourself, except for the substance and trident jars (I assume you have them on hand, hehe). All that need be done to see the tests in action is to drop 'substance.jar' and 'trident.jar' into the 'lib' directory and then run the main jar file. Those names need to be exact.

I included the Ant script I used to build this, source code and a little readme file (kind of terse version of this message, in case you forget what you're looking at).

I tested this with the build that's marked as version 7.1.00-dev, as obtained from here, since you said you wanted it tested against a dev build. I noticed some pretty bizarre behavior from the progress bar that doesn't get calls to it's updateUI() method. Apparently it does update, but it updates incorrectly and can display some very wacky and inaccurate stuff. Most of the time it'll display as either 0% or 100%, while the text version displays perfectly fine.

substance-bug.zip

kirill-grouchnikov added a commit that referenced this issue Jul 28, 2017
Issue #34 - fixed inverted preview of vertical sliders in color choosers
Issue #35 - fixed incorrect scaling of glowing icons on title pane
Issue #36 - fixed incorrect rendering of offscreen progress bars

Also updated the year and the footnote of the license
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant