我已經創建了一個textarea,並且我需要一個應用於textarea的滾動條,當需要的時候(當文本變得太長而且不能再被讀取時)。Java Textarea ScrollPane
這是我寫的代碼,但由於某種原因,滾動條不真的出現?
final JTextArea textArea = new JTextArea();
textArea.setEditable(false);
textArea.setBounds(10, 152, 456, 255);
textArea.setBorder(border);
textArea.setLineWrap(true);
sbrText = new JScrollPane(textArea);
sbrText.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
panel_1.add(textArea);
求神知的原因是什麼第二次:http://stackoverflow.com/questions/9624305/using-a-jscrollpane-with-a-jtextarea – 2012-03-08 20:37:19