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

JTabbedPane in Windows L&F doesn't properly paint the bottom right corner of the most right tab

    Details

      Description

      Operating system: Windows XP SP2
      jdk: 1.7 b15

      JTabbedPane in Windows L&F doesn't properly paint the bottom right corner of the most right tab. There is a test case:

      ========== Source Begin =============
      import javax.swing.border.*;
      import javax.swing.*;
      import java.awt.*;

      public class JTabbedPaneTest extends JPanel {

          public static void main(String[] args) throws Exception {
              SwingUtilities.invokeAndWait(new Runnable() {
                  public void run() {
                      setWindowsLaF();
                      JFrame frame = new JFrame("Unpainted Corner");
                      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                      frame.getContentPane().add(new JTabbedPaneTest());
                      frame.setSize(640, 480);
                      frame.setVisible(true);
                  }
              });
          }

          private static void setWindowsLaF() {
              try {
                  UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
              } catch (Exception e) {
                  System.out.println("Cannot set com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
                  System.exit(0);
              }
          }

          public JTabbedPaneTest() {
              setBorder(new EmptyBorder(8, 8, 8, 8));
              setLayout(new BorderLayout());

              JTabbedPane tabbedPane = new JTabbedPane();
              tabbedPane.addTab("First Tab", createTabContent());
              tabbedPane.addTab("Second Tab", createTabContent());
              tabbedPane.setSelectedIndex(1);

              add(tabbedPane, BorderLayout.CENTER);
          }


          private JComponent createTabContent() {
              JLabel label = new JLabel("<html><body>Tab Content:<br>JLabel with black line border</body></html>");
              label.setBorder(new LineBorder(Color.BLACK));
              label.setHorizontalAlignment(JLabel.CENTER);
              return label;
          }
      }
      ========== Source End ==============

      Testing strategy:
      1. Set the "Windows XP" desktop theme.
      2. Run the test.
      2. Look at the "Second Tab". Note that there are two unpainted pixels and one unnecessary pixel at the bottom right corner of the tab. See the attached screen shots.

      Expected behavior:
      The bottom right corner of the "Second Tab" is painted as in native windows applications. See the attached screen shots.

      Actual behavior:
      The bottom right corner of the "Second Tab" is painted improperly. See the attached screen shots.

        Attachments

          Activity

            People

            • Assignee:
              vdyakov Victor Dyakov
              Reporter:
              mlapshin Mikhail Lapshin (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Imported:
                Indexed: