textareas - textArea.setEditable(false program can call...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Text Areas Text Areas Use JTextArea for multiple lines of text Can specify number of rows and columns: • setText : to set the text of a text field or text area • append : to add text to the end of a text area final int ROWS = 10; final int COLUMNS = 30; JTextArea textArea = new JTextArea(ROWS, COLUMNS); Text Areas Use newline characters to separate lines: To use for display purposes only: textArea.append(account.getBalance() + "\n");
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: textArea.setEditable(false); // program can call setText and append to change it Text Areas To add scroll bars to a text area: You then add the scroll pane to the panel or frame (not the text area) JTextArea textArea = new JTextArea(ROWS, COLUMNS); JScrollPane scrollPane = new JScrollPane(textArea); Text Areas Figure 8: The TextAreaViewer Application...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online