JPanel XOR Graphics Is Wrong Color After Scrolling A Combo-Box
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
openjdk-8 (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
Normally, XOR graphics in a JPanel works fine (and is the right color).
But if you open (expand) a combo-box, and scroll it, then select the item that was formerly selected, the next time you do XOR graphics in an adjacent JPanel, the color is wrong.
In this particular case, the color being XOR'ed is pure blue (0,0,255), but instead of blue, it appears on the screen as yellow. The graphics area background is white (255,255,255).
I expected the color of the XOR'ed note-head ellipse to be blue (as it was in openjdk-7), but it was instead yellow, but it only happens after scrolling a combo-box in an adjacent panel.
This problem appeared when Open Java 8 became the default JRE in Ubuntu. It happens in most (probably all) Ubuntu variants.
aere@Aere-
Description: Ubuntu 16.04.1 LTS
Release: 16.04
Installed version: 8u91-b14-
I will attach the source code of part of the application that does the XOR graphics, and in that file, the following method does the XOR graphics:
public void markNote(int keyOffset)
I will also attach a Debian package which will allow you to install a 30-day free-trial version of the KeyMusician Keyboard application, which will allow you to reproduce the problem.
To reproduce the problem:
1. Run the KeyMusician Keyboard application (you can use the default, pre-loaded soundfont of the Java Sound (Gervill) synthesizer).
2. When the music-staff is displayed, type some letter keys (or click with the mouse in the musical staff graphics display area. You should see round filled dots appear, whose color is blue. This is the expected behavior.
3. Click on the combo-box above the "ASSIGNABLE" slider, which opens the combo-box. Then use its scroll-bar to scroll it all the way to the bottom, and back to the top. Then re-select what was already selected ("modulation", in the default Linux configuration).
4. Type some letter-keys (or click in the musical staff graphics area). This time, the filled-circles (the note-heads) will be yellow. They will remain yellow, even if you iconify & restore the application window, or click on other tabbed panels (for the different function keys.
The method doing the XOR graphics is the following:
public void markNote(int keyOffset)
{
if (!isSetup && keyOffset >= 0 && keyOffset < NUM_KEYS)
{
dim = getSize() ;
height = dim.getHeight() ;
width = dim.getWidth() ;
double markHeight = keyWidth ;
double markWidth = keyWidth * 1.25 ;
double y = height - (keyOffset + 1) * keyWidth ;
double x = shortLineStart + (shortLineLength / 2) - (markWidth / 2) ;
if (isExternalNote)
{
}
else
{
// g2.setPaint(
}
}
}
ProblemType: Bug
DistroRelease: Ubuntu 16.04
Package: openjdk-8-jre 8u91-b14-
ProcVersionSign
Uname: Linux 4.4.0-31-generic i686
ApportVersion: 2.20.1-0ubuntu2.1
Architecture: i386
CurrentDesktop: LXDE
Date: Mon Aug 8 19:45:42 2016
InstallationDate: Installed on 2013-05-18 (1178 days ago)
InstallationMedia: Lubuntu 13.04 "Raring Ringtail" - Release i386 (20130423.1)
SourcePackage: openjdk-8
UpgradeStatus: Upgraded to xenial on 2016-07-22 (18 days ago)
On the surface, this error report may appear quite bizarre, but I have spent a lot of time narrowing-down the conditions that trigger the problem.
Since Ubuntu 16.04 came out in April, I have been seeing the yellow notes, but have been unable to identify what triggered them. I finally spent a lot of time trying to narrow down the trigger, and this is what I have come up with.
A few additional points may be useful to consider:
1. You have to actually scroll the combo-box. If you just expand the combo-box, and select anything within the range displayed, the problem does not occur.
2. Even if you scroll a combo-box in another pane (such as the "F1 Help / Setup" pane's "Configuration Files" combo-box), it will affect all the other tabbed-panes.
3. Although the "Instrument" combo-box being scrolled will trigger the problem on many machines, it would not trigger the problem on all of my test machines. Only the "ASSIGNABLE" slider's combo-box (and the "Configuration Files" combo-box on the "F1" pane) will trigger the problem on all of my test machines.
4. Although the "ASSIGNABLE" slider's combo-box has both an Action-Performed and State-Change listener, the only action taken by those listeners is to log the event using System. out.println( ). The configuration files combo-box, on the other hand, has a lot of side-effects.
5. It may seem far-fetched that a component in a separate panel can affect the graphics in an adjacent panel, but I can point out cases you can reproduce (bugs I have been living with for a long time without reporting) where this is definitely the case. For instance, if you hit a key to produce a note immediately to the left of one of sliders (holding it down so the dot remains displayed), and while doing so, manipulate the slider to the right of the note using the mouse, the note-dot gets erased, even though the key producing the note is left down (and the note's sound continues audibly). This problem has been observed in openjdk-7, and on Oracle Java as well. I can submit a problem report for that if you wish.
I will attached a text-file containing the System. out.println( ) entries in the area where the problem occurred. I did not observe anything out of the ordinary for cases with the yellow notes.