JDK-7174221 : JMenu has dark foreground in Ambiance theme of Ubuntu and native L&F
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 7
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux_ubuntu
  • CPU: x86
  • Submitted: 2012-06-05
  • Updated: 2012-06-07
  • Resolved: 2012-06-07
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.7.0_04"
Java(TM) SE Runtime Environment (build 1.7.0_04-b20)
Java HotSpot(TM) Server VM (build 23.0-b21, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Linux antonioni-desktop 3.2.0-24-generic-pae #39-Ubuntu SMP Mon May 21 18:54:21 UTC 2012 i686 i686 i386 GNU/Linux

EXTRA RELEVANT SYSTEM CONFIGURATION :
Default configuration.

A DESCRIPTION OF THE PROBLEM :
When a Swing desktop application using the native L&F has JMenu components, they have a dark foreground color in the Ambiance theme (the default theme of Ubuntu), becoming unreadable - because the background color of the Jmenu component is dark, too.

When the theme is a light theme, like the Ambiance theme, the foreground color of the JMenu component is legible.

REGRESSION.  Last worked in version 7

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Open a Swing desktop application using the native L&F with JMenu components in the Ubuntu system, using the Ambiance theme (the default theme).
See that the foregrounds of the JMenus are dark, becoming unreadable.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
A readable foreground in JMenu components (see the native menus of the Ambiance theme).
ACTUAL -
The foreground of the JMenu component is unreadable.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
package javaapplication;

import javax.swing.JFrame;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

public class JavaApplicationFrame extends JFrame {

  private javax.swing.JMenu jMenu1;
  private javax.swing.JMenu jMenu2;
  private javax.swing.JMenuBar jMenuBar1;

  public JavaApplicationFrame() {
    initComponents();
  }

  private void initComponents() {

    jMenuBar1 = new javax.swing.JMenuBar();
    jMenu1 = new javax.swing.JMenu();
    jMenu2 = new javax.swing.JMenu();

    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

    jMenu1.setText("File");
    jMenuBar1.add(jMenu1);

    jMenu2.setText("Edit");
    jMenuBar1.add(jMenu2);

    setJMenuBar(jMenuBar1);

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 400, Short.MAX_VALUE));
    layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 279, Short.MAX_VALUE));

    pack();
  }

  public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    new JavaApplicationFrame().setVisible(true);
  }
}

---------- END SOURCE ----------