Skip to content

Commit

Permalink
Include SourceCodePro font
Browse files Browse the repository at this point in the history
  • Loading branch information
RezwanArefin01 committed Sep 16, 2022
1 parent e34744b commit f583ae8
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 17 deletions.
1 change: 0 additions & 1 deletion src/main/java/duke/ui/Gui.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public void start(Stage stage) {
Scene scene = new Scene(mainWindow);
stage.setScene(scene);

// create path = current directory / data / data.txt
Path path = Paths.get(System.getProperty("user.dir"), "data", "data.txt");
fxmlLoader.<MainWindow>getController().initDuke(path);

Expand Down
Binary file added src/main/resources/css/SourceCodePro-Regular.ttf
Binary file not shown.
8 changes: 8 additions & 0 deletions src/main/resources/css/fontstyle.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@font-face {
src: url('SourceCodePro-Regular.ttf');
}

.button, .text-field, .text {
-fx-font-family: 'Source Code Pro', monospace;
-fx-font-size: 14;
}
11 changes: 4 additions & 7 deletions src/main/resources/view/DialogBox.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,14 @@
<?import javafx.geometry.Insets?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.shape.Circle?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?>
<?import javafx.scene.text.TextFlow?>
<fx:root alignment="TOP_RIGHT" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" type="javafx.scene.layout.HBox" xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml/1">
<children>

<fx:root alignment="TOP_RIGHT" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" stylesheets="@../css/fontstyle.css" type="javafx.scene.layout.HBox" xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml/1">
<children>
<TextFlow fx:id="textFlow">
<children>
<Text fx:id="text" strokeType="OUTSIDE" strokeWidth="0.0" text="Text">
<font>
<Font name="Source Code Pro" size="14.0" />
</font>
<Text fx:id="text" strokeType="OUTSIDE" strokeWidth="0.0" styleClass="text" text="Text">
</Text>
</children>
<HBox.margin>
Expand Down
12 changes: 3 additions & 9 deletions src/main/resources/view/MainWindow.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<VBox spacing="1.0" xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml/1" fx:controller="duke.ui.MainWindow">

<VBox spacing="1.0" stylesheets="@../css/fontstyle.css" xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml/1" fx:controller="duke.ui.MainWindow">
<children>
<ScrollPane fx:id="scrollPane" fitToWidth="true" hbarPolicy="NEVER" hvalue="1.0" prefWidth="700.0" vvalue="1.0" VBox.vgrow="ALWAYS">
<content>
Expand All @@ -20,21 +20,15 @@
</ScrollPane>
<HBox>
<children>
<TextField fx:id="userInput" onAction="#handleUserInput" promptText="Enter command here..." HBox.hgrow="ALWAYS">
<TextField fx:id="userInput" onAction="#handleUserInput" promptText="Enter command here..." styleClass="text-field" HBox.hgrow="ALWAYS">
<opaqueInsets>
<Insets />
</opaqueInsets>
<font>
<Font name="Source Code Pro" size="14.0" />
</font>
<HBox.margin>
<Insets bottom="1.0" left="1.0" right="1.0" top="1.0" />
</HBox.margin>
</TextField>
<Button fx:id="sendButton" mnemonicParsing="false" onAction="#handleUserInput" text="Send">
<font>
<Font name="Source Code Pro" size="14.0" />
</font>
<HBox.margin>
<Insets bottom="1.0" left="1.0" right="1.0" top="1.0" />
</HBox.margin>
Expand Down

0 comments on commit f583ae8

Please sign in to comment.