Skip to content

Commit

Permalink
Clean up GUI
Browse files Browse the repository at this point in the history
  • Loading branch information
luo-git committed Sep 6, 2020
1 parent d0f24a4 commit ea998d8
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 8 deletions.
3 changes: 3 additions & 0 deletions src/main/java/luoyi/duke/MainApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;
import luoyi.duke.data.Duke;
Expand All @@ -26,6 +27,8 @@ public void start(Stage stage) {
Scene scene = new Scene(ap);
stage.setScene(scene);
stage.setTitle("CatBot");
stage.getIcons().add(new Image(MainApp.class.getResourceAsStream("/images/icon.jpg")));
stage.setResizable(false);
fxmlLoader.<MainWindow>getController().setDuke(duke);
stage.show();
} catch (IOException e) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/luoyi/duke/commands/DeleteCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ private String handleDelete(int index) throws DukeIllegalArgumentException {
if (index < 1 || index > duke.getNumTask()) {
throw new DukeIllegalArgumentException("Task index out of bound!");
}
String output = Message.REMOVED_TASK.toString() + "\t" + duke.getTask(index)
+ "\n Now you have " + (duke.getNumTask() - 1) + " task(s) in the list.";
deleteTask(index);
String output = Message.REMOVED_TASK.toString() + "\n\t" + duke.getTask(index)
+ "\n Now you have " + duke.getNumTask() + " task(s) in the list.";
System.out.print(TextFormatter.getFormattedText(output));
return output;
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/luoyi/duke/ui/DialogBox.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import javafx.scene.Node;
import javafx.scene.control.Label;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.HBox;
import javafx.scene.paint.ImagePattern;
import javafx.scene.shape.Circle;
import luoyi.duke.MainWindow;

Expand All @@ -25,7 +25,7 @@ public class DialogBox extends HBox {
@FXML
private Label dialog;
@FXML
private ImageView displayPicture;
private Circle displayPicture;

private DialogBox(String text, Image img) {
try {
Expand All @@ -38,7 +38,7 @@ private DialogBox(String text, Image img) {
}

dialog.setText(text);
displayPicture.setImage(img);
displayPicture.setFill(new ImagePattern(img));
}

/**
Expand Down
Binary file modified src/main/resources/images/cat.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/images/icon.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 6 additions & 3 deletions src/main/resources/view/DialogBox.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@

<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.shape.Circle?>
<?import javafx.scene.text.Font?>

<fx:root alignment="TOP_RIGHT" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefWidth="400.0" type="javafx.scene.layout.HBox" xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml/1">
<children>
<Label fx:id="dialog" minHeight="-Infinity" stylesheets="@style.css" text="Label" wrapText="true">
<font>
<Font size="13.0" />
</font></Label>
<ImageView fx:id="displayPicture" fitHeight="99.0" fitWidth="99.0" pickOnBounds="true" preserveRatio="true" />
</font>
<HBox.margin>
<Insets left="10.0" right="10.0" />
</HBox.margin></Label>
<Circle fx:id="displayPicture" fill="DODGERBLUE" radius="53.0" />
</children>
<padding>
<Insets bottom="15.0" left="5.0" right="5.0" top="15.0" />
Expand Down

0 comments on commit ea998d8

Please sign in to comment.