Section 12.20 JTextArea

• A JTextArea (p. 539)—a subclass of JTextComponent—may contain multiple lines of text.

• Class Box (p. 540) is a subclass of Container that uses a BoxLayout layout manager (p. 541) to arrange the GUI components either horizontally or vertically.

Box static method createHorizontalBox (p. 541) creates a Box that arranges components from left to right in the order that they’re attached.

• Method getSelectedText (p. 541) returns the selected text from a JTextArea.

• You can set the horizontal and vertical scrollbar policies (p. 542) of a JScrollPane when it’s constructed. JScrollPane methods setHorizontalScrollBarPolicy (p. 542) and setVertical ScrollBarPolicy (p. 542) can be used to change the scrollbar policies at any ...

Get Java™ How To Program (Early Objects), Tenth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.