Hello, please can someone show me code to make my JTextArea scrollable ?
I used this code but it doesn't scroll just expand my JTextArea out of JFrame.
Part of code I used(one that doesn't work):
Quote:
public class GraphicsDemo {
public GraphicsDemo {
/*Previous code*/
JFrame frame = new JFrame("New Frame");
JPanel panel = new JPanel();
output = new JTextArea(5,30);
output.setEditable(false);
JScrollPane scrollPane = new JScrollPane(output);
panel.add(output);
panel.add(scrollPane);
frame.add(panel);
frame.setVisible(true);
frame.setSize(300,300);
}
}
|
Similar code is in in Java 6 Official Tutorial
http://java.sun.com/docs/books/tutor...crollpane.html
http://java.sun.com/docs/books/tutor...olBarDemo.java