Skip to content

Commit

Permalink
Resolve truncation issue with labels
Browse files Browse the repository at this point in the history
  • Loading branch information
chunweii committed Sep 14, 2021
1 parent 9b4c041 commit 66de53f
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -54,7 +54,7 @@ checkstyle {
}

javafx {
version = "11"
version = "11.0.2"
modules = [ 'javafx.controls', 'javafx.fxml' ]
}

Binary file added docs/Ui.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions src/main/java/duke/ui/DialogBox.java
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ public class DialogBox extends HBox {
/**
* Creates a new dialog box ui that contains the message in l and the profile picture in image.
*
* @param l the message to be displayed
* @param l the message to be displayed
* @param image the profile picture to be displayed
*/
public DialogBox(String l, Image image) {
@@ -41,13 +41,13 @@ public DialogBox(String l, Image image) {
e.printStackTrace();
}

dialog.setText(l);
dialog.setText(l + "\r"); // Adds a new line to resolve truncation issues with javafx.

dialog.setWrapText(true);
circleDisplayPicture.setImage(image);
resizeAndClip(circleDisplayPicture);
}

private static void resizeAndClip(ImageView iv) {
iv.setPreserveRatio(true);
double aspectRatio = iv.getImage().getWidth() / iv.getImage().getHeight();
@@ -65,7 +65,7 @@ private static void resizeAndClip(ImageView iv) {
/**
* Gets the user dialog box with the user input and their profile picture.
*
* @param userInput the user input
* @param userInput the user input
* @param profilePic the profile picture
* @return the user dialog box
*/
3 changes: 2 additions & 1 deletion src/main/resources/view/DialogBox.fxml
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@
-fx-background-radius: 5px;
-fx-background-insets: 0,1;
-fx-font-family: 'Consolas', 'monospace';"
textFill="#e1e0e0"/>
textFill="#e1e0e0"
ellipsisString=""/>
<ImageView fx:id="circleDisplayPicture"/>
</fx:root>

0 comments on commit 66de53f

Please sign in to comment.