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

Mantis, Vertical JSlider with Right_To_Left Component is broken under GTK LAF

XMLWordPrintable

    • tiger
    • generic
    • generic
    • Verified



      Name: jbT81659 Date: 01/28/2003

      Locale: all tested locales (Windows, Solaris, Linux)
      Regression: NO
      Build: JDK1.4.2-b14 (Mantis )

      Setting the Component Orientation for a Vertical JSlider to (Right_To_Left) does not affect
      the Vertical JSlider. Vertical JSlider with Right_To_Left component Orientation looks like
      a Left_To_Right Vertical JSlider with the Tick Marks positioned to the right of the component.

      To reprduce bug:

      1. Compile and run the following code "jVerticalSlider.java" using the following command:
         "java -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel jVerticalSlider"
      2. Note that the JSlider on the Left (default Component Orientation) is displayed as expected
      3. Note that the JSlider on the Right (Right_To_Left Component Orientation)is displayed with Left_To_Right
         Component Orientation

      ---------------------------------Code-------------------------

      /* Copyright (c) Sun Microsystems 1998
      $Header: $
      */

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

      public class jVerticalSlider extends JApplet
      {
              public void init()
              {
                      vSlider slide = new vSlider();
                      getContentPane().add(slide);
          }
              public static void main(String[] argv)
              {
              JFrame frame = new JFrame("\u0645\u062b\u0627\u0644");
              frame.setContentPane(new vSlider());
              frame.pack();
              frame.setVisible(true);
              frame.addWindowListener( new WindowAdapter()
              {
                   public void windowClosing( WindowEvent e)
                   {
                       System.exit(0);
                   }
              });
              }
      }

      class vSlider extends JPanel
      {
          JSlider Left_Vertical_Slider, Right_Vertical_Slider;
              public vSlider()
              {
              this.setLayout(new BorderLayout());
              this.setPreferredSize(new Dimension(150,150));
              Left_Vertical_Slider = new JSlider(JSlider.VERTICAL, 0, 50, 25);
              Right_Vertical_Slider = new JSlider(JSlider.VERTICAL, 0, 50, 25);
              Right_Vertical_Slider.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);

              Left_Vertical_Slider.setName("Left_To_Right Vertical JSlider");
              Right_Vertical_Slider.setName("Right_To_Right Vertical JSlider");

              Left_Vertical_Slider.setMinorTickSpacing(2);
              Left_Vertical_Slider.setMajorTickSpacing(10);
              Left_Vertical_Slider.setPaintTicks(true);
              Left_Vertical_Slider.setPaintLabels(true);
              Left_Vertical_Slider.setLabelTable(Left_Vertical_Slider.createStandardLabels(10));

              Right_Vertical_Slider.setMinorTickSpacing(2);
              Right_Vertical_Slider.setMajorTickSpacing(10);
              Right_Vertical_Slider.setPaintTicks(true);
              Right_Vertical_Slider.setPaintLabels(true);
              Right_Vertical_Slider.setLabelTable(Left_Vertical_Slider.createStandardLabels(10));

              Left_Vertical_Slider.setPreferredSize(new Dimension(50,50));
              Right_Vertical_Slider.setPreferredSize(new Dimension(50, 50));

              add(Left_Vertical_Slider, BorderLayout.WEST);
              add(Right_Vertical_Slider, BorderLayout.EAST);

      /*
              JLabel label1=new JLabel("Left_To_Right JSlider");
              JLabel label2=new JLabel("Right_To_Left JSlider");
              label1.setFont(new Font("Lucida Sans Regular",Font.PLAIN,12));
              label2.setFont(new Font("Lucida Sans Regular",Font.PLAIN,12));
              add(label1, BorderLayout.WEST);
              add(label2, BorderLayout.EAST);
      */
              }
      }
      --------------------------------------------------------------
      ======================================================================

            joutwatesunw Joshua Outwater (Inactive)
            jbenavrasunw Jonathan Benavraham (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: