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

Mantis JDk1.4.2-b11, JSlider fails to display with GTK LAF

XMLWordPrintable

    • b14
    • generic
    • generic
    • Verified



      Name: jbT81659 Date: 12/26/2002

      Locale: en_US, ar_SA, ar_EG, iw_IL
      Regression: NO
      Build: b11
      Tested Platforms: Windows2000, Windows XP, Solaris Intel

      JSlider is not displayed when the LookAndFeel is set to GTKLookAndFeel. The following
      test case (jSlider.java) displayes a JLabel and a JSlider in a frame. Under Metal LAF,
      Windows LAF and Motif LAF, both the JLabel and JSlider are displayed in the Frame as expected.
      When running this test with the GTK LAF, only the Jlabel is displayed while JSlider disappears.

      To reproduce this bug:

      1. Log to a Windows or Solaris platform of your choice
      2. Verify that the installed jdk is jdk1.4.2-b11
      3. Compile the following test case (jSlider.java)
      4. Run the test case first using the command:
         "java jSlider"
      5. Note that a Frame is displayed with a Label and a Slider
      6. Click with mouse over the JSlider
      7. Press the Home, End , PgUp, PgDown button to verify the JSlider is working as expected
      8. Close the Frame
      9. Run the test case again with the command
        "java -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel jSlider"
      10. Note that the Frame is displayed
      11. Note that the Label is displayed
      12. Note that Slider is not displayed
      13. Close the Frame
      14. Run the test case again with the command:
        "java -Dswing.defaultlaf=com.sun.java.swing.plaf.motif.MotifLookAndFeel jSlider"
      15. Note that the Frame is displayed with the Label and Slider as expected
      16. Close the Frame
      17. Run the test case again with the command:
        "java -Dswing.defaultlaf=com.sun.java.swing.plaf.windows.WindowsLookAndFeel jSlider"
      18. Note that the Frame is displayed with the Label and Slider as expected

      -----------------------------Source Code-----------------------------------------

      /* Copyright (c) Sun Microsystems 1998

      $Header: /home-bazelet/sun/src/javaLab/JDK1.4/LAF/jSlider.java,v 1.1.1.1 2001/06/19 15:01:25 isam Exp $

      */

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

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

      }

      }

      class jSlider1 extends JPanel
      {

      public jSlider1()
      {


                      this.setLayout(new BorderLayout());
                      setLayout(new FlowLayout());
                      JSlider slider = new JSlider(JSlider.HORIZONTAL, 0, 50, 25);
           slider.setMinorTickSpacing(2);
           slider.setMajorTickSpacing(10);
           slider.setPaintTicks(true);
           slider.setPaintLabels(true);
           slider.setLabelTable(slider.createStandardLabels(10));
           add(slider, BorderLayout.CENTER);
                      JLabel label=new JLabel("\u0647\u0630\u0627\u0020\u064a\u0648\u0645\u0020\u0644\u0637\u064a\u0641\u0020\u05d6\u05d4\u0020\u05d9\u05d5\u05dd\u0020\u05e0\u05e2\u05d9\u05dd");
                      label.setFont(new Font("Lucida Sans Regular",Font.PLAIN,12));
                      add(label);
         }

      }

      ---------------------------------------------------------------------------------
      ======================================================================

            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: