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

ScrollPane scrolls with setWheelScrollingEnabled(false)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Won't Fix
    • Affects Version/s: 1.4.0
    • Fix Version/s: None
    • Component/s: client-libs
    • Labels:
    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_98

      Description

      A scrollpane scrolls when the mouse wheel is moved even though the setWheelScrollingEnabled is set to false. This can be demonstrated by running the application given below. Run the application and you will get a scrollpane with a panel of buttons. This is scrollable by default. Click the 'disable' button. The scrollpane still scrolls when the mouse wheel is moved.

      import java.awt.*;
      import java.awt.event.*;

      public class MouseWheelScrollingTest extends Frame{

              public MouseWheelScrollingTest(){
                      super();
              }


        public static void main (String [] args){

              final MouseWheelScrollingTest frame1 = new MouseWheelScrollingTest();
              final ScrollPane MyScrollPane = new ScrollPane();
              final Button MyButton = new Button("Disable");

              Panel panel = new Panel(new GridLayout(2,1));
              Panel buttonPanel = new Panel(new GridLayout(10,10));
              for(int i=0; i<20; i++)
                      buttonPanel.add(new Button("Button"));
              panel.add(buttonPanel);

              MyScrollPane.add(panel);

              frame1.setLayout(new BorderLayout());
              frame1.add(MyScrollPane,"Center");
              frame1.add(MyButton,"South");

              MyButton.addActionListener(new ActionListener(){
                      public void actionPerformed(ActionEvent ae){
                                      boolean bool;
                                      bool = MyScrollPane.isWheelScrollingEnabled();
                                      if (bool){
                                              MyScrollPane.setWheelScrollingEnabled(false);
                                              MyButton.setLabel("Enable");
                                      }
                                      else{
                                              MyScrollPane.setWheelScrollingEnabled(true);
                                              MyButton.setLabel("Disable");
                                      }
                                      System.out.println("Wheel scrolling is currently : " + MyScrollPane.isWheelScrollingEnabled());

                              }

                      });
              frame1.addWindowListener(new WindowAdapter(){
                              public void windowClosing(WindowEvent we){
                                      frame1.dispose();
                              }
                      });
              frame1.setSize(400,200);
              frame1.setVisible(true);

              }



      }

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              bchristi Brent Christian
              Reporter:
              kjethisunw Kanishk Jethi (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: