Hi,
I have been working on a ScrollPane and I need to increase the increments (when you press the up and down arrow), and also make it respond to a mouse scroll wheel.

The code I have (one screen in a CardLayout) is:

public void instructions ()
    {
        resize (800, 680);

        instructions = new Panel ();

        JLabel title = new JLabel (createImageIcon ("images//instructionstitle.jpg"));
        JTextArea objective = new JTextArea ("Objective:");

        ScrollPane scrollPane = new ScrollPane ();
        //scrollPane = new ScrollPane (ScrollPane.SCROLLBARS_AS_NEEDED);
        scrollPane.setSize (new Dimension (800, 670));
        scrollPane.add (title);

        instructions.add (scrollPane);
        screens.add ("2", instructions);
    }

I am thinking I need to use one of the mouse event handlers, and maybe create additional methods?

Thank you.

use :

JScrollPane scrollPane; //do not mix swing with awt ScrollPane
scrollPane.setWheelScrollingEnabled(true);//usefull method

about JScrollPane read in java tutorial

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.