Open JiaXinEu opened 2 weeks ago
Label and ImageView is created in handleUserInput and passed to DialogBox, which may increase dependency and reduce readability of code.
Constructor of DialogBox can be something as below:
public DialogBox (String s, Image i) { text = new Label(s); displayPicture = new ImageView(i); // ... }
handleUserInput can be something as below:
private void handleUserInput() { String userText = userInput.getText(); String dukeText = getResponse(userInput.getText()); dialogContainer.getChildren().addAll( new DialogBox(userText, user), new DialogBox(dukeText, duke) ); userInput.clear(); }
@JiaXinEu You can send a PR for this.
Current:
Problem:
Label and ImageView is created in handleUserInput and passed to DialogBox, which may increase dependency and reduce readability of code.
Proposed:
Constructor of DialogBox can be something as below:
handleUserInput can be something as below: