email me at borlaj@portlandschools.org

Loading
notes previous (10/<10) submit the dump links  
 

TextArea

 

To use a textarea its almost the same as textfield, except to add text to whats already there use the method append.

 

So if you had a textarea

JTextArea cardsReceived = new JTextArea (8,15);

 

And you wanted to append it:

cardsReceived.append("Whatever text you wanted to show");

The new line character is \n so if you wanted a new line you might say

cardsReceived.append("\n");

Or

cardsReceived.append("Here is my new line!\n");

If you wanted to erase all text you might say:

cardsReceived.setText("");

 

To add scrollbars:

JScrollPane scrollTxt = new JScrollPane(cardsReceived);

screen.add(scrollTxt);