← Back to team overview

openjdk team mailing list archive

[Bug 1611180] [NEW] JPanel XOR Graphics Is Wrong Color After Scrolling A Combo-Box

 

Public bug reported:

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-Dell-Inspiron:~$ lsb_release -rd
Description:	Ubuntu 16.04.1 LTS
Release:	16.04

Installed version: 8u91-b14-0ubuntu4~16.04.1

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)
    {
        System.out.println("(un)markNote(" + keyOffset + ")" + "external=" + isExternalNote) ;
        if (!isSetup && keyOffset >= 0 && keyOffset < NUM_KEYS)
        {
            dim = getSize() ;
            height = dim.getHeight() ;
            width = dim.getWidth() ;
            commonSetup() ;
            double markHeight = keyWidth  ;
            double markWidth = keyWidth * 1.25 ;
            double y = height - (keyOffset + 1) * keyWidth ;
            double x = shortLineStart + (shortLineLength / 2) - (markWidth / 2) ;
            System.out.println("markNote " + x + "," + y) ;
            System.out.println("BG=" + g2.getBackground() + ", FG=" + g2.getPaint() + ", newBG=" + backGround + ", newFG=" + foreGround) ; // TEMPORARY
            g2.setXORMode(backGround) ;
            g2.setColor(foreGround) ;
            if (isExternalNote)
            {
                g2.setPaint(KEY_MARK_COLOR_EXTERNAL) ;
            }
            else
            {
//                g2.setPaint(KEY_MARK_COLOR) ;
                g2.setPaint(Color.BLUE) ;
            }
            Ellipse2D.Double mark = new Ellipse2D.Double(x, y, markWidth, markHeight) ;
            g2.fill(mark) ;
            System.out.println("Color=" + g2.getPaint()) ; // TEMPORARY
            g2.setPaintMode() ;
        }
    }

ProblemType: Bug
DistroRelease: Ubuntu 16.04
Package: openjdk-8-jre 8u91-b14-0ubuntu4~16.04.1
ProcVersionSignature: Ubuntu 4.4.0-31.50-generic 4.4.13
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)

** Affects: openjdk-8 (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: apport-bug i386 xenial

** Attachment added: "Debian package to install a 30-day free-trial version of the KeyMusician Keyboard"
   https://bugs.launchpad.net/bugs/1611180/+attachment/4717130/+files/keymusician-keyboard_1.23_all.deb

-- 
You received this bug notification because you are a member of OpenJDK,
which is subscribed to openjdk-8 in Ubuntu.
https://bugs.launchpad.net/bugs/1611180

Title:
  JPanel XOR Graphics Is Wrong Color After Scrolling A Combo-Box

Status in openjdk-8 package in Ubuntu:
  New

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-Dell-Inspiron:~$ lsb_release -rd
  Description:	Ubuntu 16.04.1 LTS
  Release:	16.04

  Installed version: 8u91-b14-0ubuntu4~16.04.1

  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)
      {
          System.out.println("(un)markNote(" + keyOffset + ")" + "external=" + isExternalNote) ;
          if (!isSetup && keyOffset >= 0 && keyOffset < NUM_KEYS)
          {
              dim = getSize() ;
              height = dim.getHeight() ;
              width = dim.getWidth() ;
              commonSetup() ;
              double markHeight = keyWidth  ;
              double markWidth = keyWidth * 1.25 ;
              double y = height - (keyOffset + 1) * keyWidth ;
              double x = shortLineStart + (shortLineLength / 2) - (markWidth / 2) ;
              System.out.println("markNote " + x + "," + y) ;
              System.out.println("BG=" + g2.getBackground() + ", FG=" + g2.getPaint() + ", newBG=" + backGround + ", newFG=" + foreGround) ; // TEMPORARY
              g2.setXORMode(backGround) ;
              g2.setColor(foreGround) ;
              if (isExternalNote)
              {
                  g2.setPaint(KEY_MARK_COLOR_EXTERNAL) ;
              }
              else
              {
  //                g2.setPaint(KEY_MARK_COLOR) ;
                  g2.setPaint(Color.BLUE) ;
              }
              Ellipse2D.Double mark = new Ellipse2D.Double(x, y, markWidth, markHeight) ;
              g2.fill(mark) ;
              System.out.println("Color=" + g2.getPaint()) ; // TEMPORARY
              g2.setPaintMode() ;
          }
      }

  ProblemType: Bug
  DistroRelease: Ubuntu 16.04
  Package: openjdk-8-jre 8u91-b14-0ubuntu4~16.04.1
  ProcVersionSignature: Ubuntu 4.4.0-31.50-generic 4.4.13
  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)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/openjdk-8/+bug/1611180/+subscriptions


Follow ups