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

JTabbedPane with SCROLL_TAB_LAYOUT policy does not work for RTL orientation.

XMLWordPrintable

      For Left-to-right component orientation, SCROLL_TAB_LAYOUT policy works properly by displaying scrolling buttons for non-visible tabs. This is not the case for Right-to-left. The following program demonstrates this:

      ---------------------------------- Cut Here --------------------------------

      import java.awt.*;
      import javax.swing.*;

      public class CompOrient extends JFrame {
          private JTabbedPane tab;

          public static void main(String[] args) {
              new CompOrient();
          }

          public CompOrient() {
              tab = new JTabbedPane();
              tab.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
              tab.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
      // tab.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);

              for(int i = 0; i < 10; i++) {
                  JPanel panel = new JPanel();
                  JButton button = new JButton("Button " + i);
                  panel.add(button);
                  tab.add("Tab " + i, panel);
              }

              getContentPane().add(tab);
              setSize(300, 300);
              show();
          }
      }
           
      ---------------------------------- Cut Here --------------------------------

      ###@###.### 2002-12-03

            Unassigned Unassigned
            elousunw Edmund Lou (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: