JDK-6667746 : Problem with javax.swing.JComboBox on GTK theme
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 6
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux
  • CPU: x86
  • Submitted: 2008-02-26
  • Updated: 2011-02-16
  • Resolved: 2009-01-14
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
JDK/JRE 1.6.0_04

ADDITIONAL OS VERSION INFORMATION :
Linux Ubuntu 7.10, default theme (Human)

EXTRA RELEVANT SYSTEM CONFIGURATION :
Gnome 2.20.1

A DESCRIPTION OF THE PROBLEM :
I use the GTK theme in Swing applications.
The JComboBox in the GTK theme appears malformed when the GUI becomes visible, and the message below is shown in the console:

"(<unknown>:32404): Gtk-WARNING **: Attempting to add a widget with type GtkButton to a GtkComboBoxEntry (need an instance of GtkEntry or of a subclass)

(<unknown>:32404): Gtk-CRITICAL **: gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(<unknown>:32404): Gtk-CRITICAL **: gtk_paint_box: assertion `style->depth == gdk_drawable_get_depth (window)' failed"

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. I open the NetBeans IDE (version 6.0.1);
2. I create a Desktop application project;
3. I add a javax.swing.JComboBox component in the JFrame;
4. I run the project;
5. When the JFrame becomes visible, the JComboBox added is malformed and the error message appears in the console.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
1. I open the NetBeans IDE (version 6.0.1);
2. I create a Desktop application project;
3. I add a javax.swing.JComboBox component in the JFrame;
4. I run the project;
5. no error must appear in the console.
ACTUAL -
Error shown in the console.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
"(<unknown>:32404): Gtk-WARNING **: Attempting to add a widget with type GtkButton to a GtkComboBoxEntry (need an instance of GtkEntry or of a subclass)

(<unknown>:32404): Gtk-CRITICAL **: gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(<unknown>:32404): Gtk-CRITICAL **: gtk_paint_box: assertion `style->depth == gdk_drawable_get_depth (window)' failed"

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
/*
 * Main.java
 *
 */
package javaapplication;

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

public class Main {

  public static void main(String[] args) {
    try {
      UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");

      JFrame frame = new JFrame();
      JComboBox cb = new JComboBox();
      frame.add(cb);
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      frame.setSize(200, 200);
      frame.setLocation(0, 0);
      frame.setVisible(true);
    } catch (ClassNotFoundException ex) {
      ex.printStackTrace();
    } catch (InstantiationException ex) {
      ex.printStackTrace();
    } catch (IllegalAccessException ex) {
      ex.printStackTrace();
    } catch (UnsupportedLookAndFeelException ex) {
      ex.printStackTrace();
    }
  }
}

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