Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-5059053

Non-opaque JTextPane within BorderLayout is invisible under GTK L&F

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P3 P3
    • None
    • 5.0
    • client-libs
    • generic, x86
    • linux, linux_redhat_3.0


      ###@###.### 2004-06-07

      J2SE Version (please include all output from java -version flag):
        java version "1.5.0-beta2"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b51)
        Java HotSpot(TM) Client VM (build 1.5.0-beta2-b51, mixed mode)

      Does this problem occur on J2SE 1.3, 1.4.x? Yes / No (pick one)
        N/A


      Operating System Configuration Information (be specific):
        Linux with a 2.6 kernel and GNOME 2.6.

      Bug Description:
       Having a problem with Swing BorderLayout and a non-opaque
       JTextPane under the GTK Look and Feel. Basically, a JTextPane (with
       setOpaque(false)) within a BorderLayout is invisible, under the GTK Look
       and Feel.

       This bug is present on Linux on Tiger beta2 with a 2.6 kernel and
       GNOME 2.6.

      Here's some code to demonstrate the problem:

      ThingTest.java:
      ---------------
      import com.sun.java.swing.plaf.gtk.GTKLookAndFeel;

      import javax.swing.JFrame;
      import javax.swing.JTextPane;
      import javax.swing.UIManager;
      import javax.swing.UnsupportedLookAndFeelException;
      import java.awt.BorderLayout;
      import java.awt.Color;

      public class ThingTest {
           public static void main(String[] args) {
               try {
                   UIManager.setLookAndFeel(new GTKLookAndFeel());
               } catch (UnsupportedLookAndFeelException e) {
                   e.printStackTrace();
               }

               JFrame frame = new JFrame();
               frame.setLayout(new BorderLayout());

               JTextPane text = new JTextPane();
               text.setText("Plain text");
               text.setOpaque(false);

               frame.setBackground(Color.RED);
               frame.add(text, BorderLayout.NORTH);
               frame.setSize(200, 200);
               frame.setVisible(true);
           }
      }


            joutwatesunw Joshua Outwater (Inactive)
            tyao Ting-Yun Ingrid Yao (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: