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

Motif L&F: JTabbedPane.setBackgroundAt() does not work

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P3 P3
    • None
    • 1.2.0
    • client-libs
    • None


      With the Motif L&F, JTabbedPane.setBackgroundAt() does not work.

      The following application attempts to display one tab out of 5 with
      a blue background. When the app is executed, the tab is displayed with
      the default background, and not with the expected blue background.
      ==========================================================================

      /*
       * tabTest.java
       * Motif L&F: JTabbedPane.setBackgroundAt() does not work
       *
      */

      import java.awt.*;
      import java.awt.event.*;
      import com.sun.java.swing.*;

      public class tabTest extends JFrame {

        JTabbedPane tabbedPane;
        
        public tabTest()
          {
            
            tabbedPane = new JTabbedPane();
            for (int i = 0; i < 5; i++)
      {
      JPanel panel = new JPanel();
      panel.add(new JLabel("The tab titled 'Tab2' should have a blue background."));
      tabbedPane.addTab("Tab" + i, panel);
      }

            tabbedPane.setSelectedIndex(3);
            tabbedPane.setBackgroundAt(2,Color.blue);
            tabbedPane.setForegroundAt(1,Color.green);
            
            getContentPane().setLayout(new BorderLayout());
            getContentPane().add("Center", tabbedPane);
          }

        public static void main(String[] args)
          {
            tabTest frame = new tabTest();
            frame.pack();
            frame.setSize(450,350);
            frame.show();
          }
        
      }

            rschiavisunw Richard Schiavi (Inactive)
            gaurisha Gauri Sharma (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: