2016-06-27 6 views
1

INFORMATION을 사용하여 Alert를 생성했습니다. 그런 다음 TextArea를 만들고 GridPane으로 경고에 추가합니다. 이제 내 질문은 어떻게 경고의 세부 정보를 자동으로 표시 할 수 있습니까?경고의 세부 정보를 자동으로 표시하는 방법은 무엇입니까?

Alert alert = new Alert(AlertType.INFORMATION); 
    alert.setTitle("TODO Liste"); 
    alert.setContentText("Alle TODO's in der Liste:"); 
    alert.initStyle(StageStyle.UTILITY); 

    TextArea textArea = new TextArea(); 

    GridPane content = new GridPane(); 
    content.setMaxWidth(Double.MAX_VALUE); 
    content.add(textArea, 0, 0); 

    alert.getDialogPane().setExpandableContent(content); 
    alert.showAndWait(); 

편집 :

스크린 샷

enter image description here

+0

내가 그렇지 않으면 – xCihat

+0

을 표시하지 않습니다 "쇼보기"를 클릭해야하는 텍스트 영역을 볼 수 당신은 확실히에서 잠금을 가져야한다 좋은 JavaFX 튜토리얼 @ Code Makery - 특히 [JavaFX Dialog] (http://code.makery.ch/blog/javafx-dialogs-official). – SSchuette

답변

1

당신은 확장 내용이 아닌 내용를 설정하는! 그래서 당신의 내용을 설정하는 줄을 변경 Alert에 :

alert.getDialogPane().setContent(content); 
관련 문제