Skip to content

Commit

Permalink
Polish UI, including rescaling images, changing padding, etc
Browse files Browse the repository at this point in the history
  • Loading branch information
H1410101 committed Sep 22, 2023
1 parent 976c574 commit fa5cdf8
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 17 deletions.
5 changes: 4 additions & 1 deletion src/main/java/catbot/io/CatbotJavaFxController.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ void addUserDialog(String text) {
}

void queueAssistantDialogue(String text) {
queuedAssistantOutput.append("\n").append(text);
if (!queuedAssistantOutput.toString().isEmpty()) {
queuedAssistantOutput.append("\n");
}
queuedAssistantOutput.append(text);
}

void sendAssistantDialogue() {
Expand Down
9 changes: 7 additions & 2 deletions src/main/java/catbot/io/DialogBox.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ private DialogBox(String text, Image img) {
fxmlLoader.setController(this);
fxmlLoader.setRoot(this);
fxmlLoader.load();
} catch (IOException ignored) {
} catch (IOException ignored) { //noinspection UnnecessarySemicolon
;
}

Expand All @@ -51,7 +51,12 @@ private void flip() {
}

public static DialogBox getUserDialog(String text, Image img) {
return new DialogBox(text, img);
DialogBox db = new DialogBox(text, img);
db.setStyle(
db.getStyle().replaceFirst("-fx-background-color: \\w+;",
"-fx-background-color: lightsteelblue;")
);
return db;
}

public static DialogBox getDukeDialog(String text, Image img) {
Expand Down
Binary file modified src/main/resources/images/DaDuke.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 10 additions & 7 deletions src/main/resources/view/DialogBox.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,21 @@
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.text.Font?>

<fx:root alignment="CENTER_RIGHT" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefWidth="400.0" type="javafx.scene.layout.HBox" xmlns="http://javafx.com/javafx/17.0.7" xmlns:fx="http://javafx.com/fxml/1">
<fx:root alignment="CENTER_RIGHT" fillHeight="false" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefWidth="400.0" spacing="10.0" style="-fx-background-radius: 10; -fx-background-color: gainsboro;" type="javafx.scene.layout.HBox" xmlns="http://javafx.com/javafx/17.0.7" xmlns:fx="http://javafx.com/fxml/1">
<children>
<Label fx:id="dialog" text="Label" wrapText="true">
<font>
<Font name="Lucida Console" size="10.0" />
<Font name="Monospaced Regular" size="11.0" />
</font>
<HBox.margin>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</HBox.margin></Label>
<ImageView fx:id="displayPicture" fitHeight="99.0" fitWidth="99.0" pickOnBounds="true" preserveRatio="true" />
<ImageView fx:id="displayPicture" fitHeight="40.0" fitWidth="40.0" pickOnBounds="true" preserveRatio="true">
<HBox.margin>
<Insets />
</HBox.margin></ImageView>
</children>
<padding>
<Insets bottom="15.0" left="5.0" right="5.0" top="15.0" />
</padding>
<padding>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</padding>
</fx:root>
7 changes: 5 additions & 2 deletions src/main/resources/view/MainWindow.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@
<children>
<VBox prefHeight="700.0" prefWidth="600.0">
<children>
<ScrollPane fx:id="scrollPane" hbarPolicy="NEVER" hvalue="1.0" prefHeight="650.0" prefWidth="600.0" vvalue="1.0">
<ScrollPane fx:id="scrollPane" hbarPolicy="NEVER" hvalue="1.0" prefHeight="650.0" prefWidth="600.0" style="-fx-background-color: darkgray;" stylesheets="@scrollpane.css" vvalue="1.0">
<content>
<VBox fx:id="dialogContainer" prefWidth="600.0" />
<VBox fx:id="dialogContainer" prefWidth="600.0" spacing="10.0" style="-fx-background-color: darkgray;">
<padding>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</padding></VBox>
</content>
</ScrollPane>
<HBox alignment="CENTER">
Expand Down
7 changes: 7 additions & 0 deletions src/main/resources/view/scrollpane.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.scroll-pane .viewport {
-fx-background-color: darkgray;
}

.scroll-pane {
-fx-background-color:transparent;
}
5 changes: 0 additions & 5 deletions src/test/java/catbot/task/TaskListTest.java

This file was deleted.

0 comments on commit fa5cdf8

Please sign in to comment.