Java tutorial
import java.awt.Dimension; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; public class Main extends JPanel { private JScrollPane vertical; private JTextArea console; public Main() { setPreferredSize(new Dimension(200, 250)); console = new JTextArea(15, 15); vertical = new JScrollPane(console); vertical.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); add(vertical); } public static void main(String args[]) { new JFrame() { { getContentPane().add(new Main()); pack(); setVisible(true); } }; } }