run 메소드 안에 loadPage 메소드 실행 시키는 방법이 궁금해요

조회수 282회

새로운 메소드 (run method)를 써서 버튼이 클릭 되었을때 loadPage 메소드를 실행시켜야 하는데 run 메소드 안에 어떤 코드를 적어야 할지 모르겠어요..

private void loadPage() {
    urlButton.setDisable(true);
    textFlow.getChildren().clear();
    try {
        URL url = new URL(DELAY_URL + urlField.getText());
        Scanner site = new Scanner(url.openStream());
        while (site.hasNextLine()) {
            String line = site.nextLine();
            textFlow.getChildren().add(new Text(line + "\n"));
        } //whilte
    } catch (IOException ex) {
        textFlow.getChildren().add(new Text(ex.getMessage()));
    } //try
    urlButton.setDisable(false);
} //loadPage

public void run() {
}

1 답변

답변을 하려면 로그인이 필요합니다.

프로그래머스 커뮤니티는 개발자들을 위한 Q&A 서비스입니다. 로그인해야 답변을 작성하실 수 있습니다.

(ಠ_ಠ)
(ಠ‿ಠ)