편집 기록

편집 기록
  • 프로필 편집요청빌런님의 편집
    날짜2022.11.18

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


    새로운 메소드 (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() {
    }
    
  • 프로필 다이앤님의 편집
    날짜2022.11.18

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


    새로운 메소드 (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() {
    }