443 * Creates a {@code TextArea} with initial text content. 444 * 445 * @param text A string for text content. 446 */ 447 public TextArea(String text) { 448 super(new TextAreaContent()); 449 450 getStyleClass().add("text-area"); 451 setAccessibleRole(AccessibleRole.TEXT_AREA); 452 setText(text); 453 } 454 455 @Override final void textUpdated() { 456 setScrollTop(0); 457 setScrollLeft(0); 458 } 459 460 /** 461 * Returns an unmodifiable list of the character sequences that back the 462 * text area's content. 463 */ 464 public ObservableList<CharSequence> getParagraphs() { 465 return ((TextAreaContent)getContent()).paragraphList; 466 } 467 468 469 /*************************************************************************** 470 * * 471 * Properties * 472 * * 473 **************************************************************************/ 474 475 /** 476 * If a run of text exceeds the width of the {@code TextArea}, 477 * then this variable indicates whether the text should wrap onto 478 * another line. 479 */ 480 private BooleanProperty wrapText = new StyleableBooleanProperty(false) { 481 @Override public Object getBean() { 482 return TextArea.this; | 443 * Creates a {@code TextArea} with initial text content. 444 * 445 * @param text A string for text content. 446 */ 447 public TextArea(String text) { 448 super(new TextAreaContent()); 449 450 getStyleClass().add("text-area"); 451 setAccessibleRole(AccessibleRole.TEXT_AREA); 452 setText(text); 453 } 454 455 @Override final void textUpdated() { 456 setScrollTop(0); 457 setScrollLeft(0); 458 } 459 460 /** 461 * Returns an unmodifiable list of the character sequences that back the 462 * text area's content. 463 * @return an unmodifiable list of the character sequences that back the 464 * text area's content 465 */ 466 public ObservableList<CharSequence> getParagraphs() { 467 return ((TextAreaContent)getContent()).paragraphList; 468 } 469 470 471 /*************************************************************************** 472 * * 473 * Properties * 474 * * 475 **************************************************************************/ 476 477 /** 478 * If a run of text exceeds the width of the {@code TextArea}, 479 * then this variable indicates whether the text should wrap onto 480 * another line. 481 */ 482 private BooleanProperty wrapText = new StyleableBooleanProperty(false) { 483 @Override public Object getBean() { 484 return TextArea.this; |