Scroll Pane Code

Report a typo

Complete the code below to implement a scroll pane:

public class Main {
    public static void main(String[] args) {
        JFrame frame = new JFrame("Scroll Bars");
        JTextArea textArea = new JTextArea(5, 5);
        ___________ scrollPane = new JScrollPane(textArea);

        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(300, 200);

        frame.getContentPane().add(scrollPane);
        frame.setVisible(true);
    }
}
Enter a short text
___

Create a free account to access the full topic