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

JScrollPane problem in right-to-left orientation

XMLWordPrintable

    • x86
    • linux, windows_xp

      FULL PRODUCT VERSION :
      java version "1.6.0-rc"
      Java(TM) SE Runtime Environment (build 1.6.0-rc-b90)
      Java HotSpot(TM) Client VM (build 1.6.0-rc-b90, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      There is a problem in the layout of JFrame in the right-to-left mode. The main panel in the JFrame is not extended with the extend of the JFrame.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1-Run the below code
      2-Try to resize the JFrame (to bigger/smaller size)
      3-you will see that the main panel size still the same without extension.
      4 if you remove the orientation code line it will work correct in the left-to-right orientation.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Extending the main panel with the extension of the JFrame.
      ACTUAL -
      The main panel didn't extend with the extension of the JFrame.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.swing.*;
      import java.awt.*;
      import java.awt.event.*;
      import java.io.*;

      class bug3 extends JFrame
      {
      Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
      public bug3()
      {
      super();
      final JRadioButton madahebRadioButton [] = new JRadioButton [6];
      for(int i=0;i<=5;i++)
      madahebRadioButton[i] = new JRadioButton("sdrfgzdasgf");

      final JPanel generalInformationFramePanels = new JPanel();
      generalInformationFramePanels.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),"sdrfgzdasgfdasrfgsdzfg", 0, 0, null, Color.red));

      for(int i=0; i<=5; i++)
      generalInformationFramePanels.add(madahebRadioButton[i]);

      final JPanel generalInformationFrameMainPanel = new JPanel(new GridLayout(1,1));
      generalInformationFrameMainPanel.add(generalInformationFramePanels);

      setLocation(screenSize.width/2-280, screenSize.height/2-(185+25));
      getContentPane().add(new JScrollPane(generalInformationFrameMainPanel));
      pack();

      // If you remove this line it will work fine in left-to-right orientation
      getContentPane().applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);

      setBounds(100, 100, 700, 200);
      setVisible(true);
      }

      public static void main(String args[]){new bug3();}
      }
      ---------- END SOURCE ----------

            Unassigned Unassigned
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: