Q:

JApplet scrollbar using JScrollPane shows but doesn't scroll Graphics2D content outside screen

I am trying to add a scrollbar to a JApplet component. I know I shouldn't use it and should rather use JPanel, but for sake of semplicity I'll leave it like it, as in a tutorial I am following.
As you can see I tried adding a ScrollPane component, and add to it the applet. Then I add the scrollpane to the frame. 
The result is that I can see a vertical scrollbar, but that it does have the ability to scrool. Actually the scroll cursor is missing. And the up and down arrows don't scrooll too. I'd like to scroll down to the part of the line I've drawn that went outside the visible area.
What am I doing wrong?
public class App {

    private App() {
        final int WINHSIZE = 800;
        final int WINVSIZE = 600;

        class MyJApplet extends JApplet {

            public void init() {
                setBackground(Color.black);
                setForeground(Color.white);
            }

            public void paint(Graphics g) {
                Graphics2D g2 = (Graphics2D) g;
                        g2.drawLine(0, 0, 2000, 2000);
                }
            }
        }

        JFrame f = new JFrame("Title");
        f.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                System.exit(0);
            }
        });

        JApplet applet = new MyJApplet();
        JScrollPane myScrollPane = new JScrollPane(applet, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);

        f.getContentPane().add("Center", myScrollPane);
        applet.init();
        f.pack();
        f.setSize(new Dimension(WINHSIZE, WINVSIZE));
        f.setVisible(true);

    }

    public static void main(String[] args) {
        new App();
    }
}

A:

I'll leave it like it, as in a tutorial I am following. 

Well your tutorial is old and you should NOT be following it. Instead you should be learning how to create a JFrame the normal way. 
That is you do custom painting on a JPanel by overriding the paintComponent() method and you add the panel to the frame. You should NOT override paint(). Read the section from the Swing tutorial (which is a far better tutorial to follow) on Custom Painting for more information. You need to make sure to override the getPreferredSize() method so the scrollbars can work properly.
f.getContentPane().add("Center", myScrollPane);

That is not how you add a Component to a Container. You would never hardcode a constraint like that. Also you should be using:
 add(component, constraint)

The BorderLayout will contain fields you can use to identify the constraint.
People don't use f.getContentPane().add(...) anymore. Since JDK4 you can use f.add(...). As I said your tutorial is way out of date.
Look at the table of contents of the Swing tutorial. The examples are more up to date and will provide a better design for your application. For example you should be creating GUI components on the Event Dispatch Thread, which your code is NOT doing. Read the tutorial on Concurrency to understand why this is important.

