JTextArea scroll problem - have tried fixes!! Code included...
843804Jan 25 2005 — edited Jan 26 2005Hi, I'm having a mare with a JTextArea - I've created one with a JScrollPanel and attached them, but no matter what I do, it will not scroll down properly when the text gets too large. It actually types off the end of the box - i.e. you type away and the cursor moves below the text area but it doesnt scroll... you can still type (tested by typing, selecting and pasting back to the top). Below is all the code I manipulate the textarea with after creating the textarea and scroll panel;
jspText.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
jspText.setAutoscrolls(true);
jspText.setMinimumSize(new java.awt.Dimension(150, 100));
jspText.setPreferredSize(new java.awt.Dimension(450, 200));
jtaText.setText("Tablature produced during recording will appear here... Tune and Calibrate your guitar, enter the Tab Details and then hit Record to produce a new tablatue file.");
jtaText.setAutoscrolls(false);
jtaText.setMinimumSize(new java.awt.Dimension(150, 100));
jtaText.setPreferredSize(new java.awt.Dimension(150, 100));
jtaText.setSelectedTextColor(new java.awt.Color(204, 204, 255));
jtaText.setSelectionColor(new java.awt.Color(204, 255, 255));
jspText.setViewportView(jtaText);
Any help would be greatly appreciate.
N.B. Before anyone suggests reading the other posts on this - I know its a common problem, and believe me I've tried a lot of the fixes suggested - no good!
Thanks,
Jules