Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve GUI #165

Merged
merged 4 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/main/java/seedu/address/ui/MainWindow.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package seedu.address.ui;

import java.io.File;
import java.util.logging.Logger;

import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.MenuItem;
import javafx.scene.control.TextInputControl;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.input.Clipboard;
import javafx.scene.input.ClipboardContent;
import javafx.scene.input.KeyCombination;
Expand Down Expand Up @@ -37,6 +40,7 @@
private final PersonListPanel personListPanel;
private final ResultDisplay resultDisplay = new ResultDisplay();
private final HelpWindow helpWindow = new HelpWindow();
private final String iconPath = "src/main/resources/images/icon.png";

Check warning on line 43 in src/main/java/seedu/address/ui/MainWindow.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/ui/MainWindow.java#L43

Added line #L43 was not covered by tests

@FXML
private StackPane commandBoxPlaceholder;
Expand All @@ -53,6 +57,9 @@
@FXML
private StackPane statusbarPlaceholder;

@FXML
private ImageView iconImageView;

/**
* Creates a {@code MainWindow} with the given {@code Stage} and {@code Logic}.
*/
Expand Down Expand Up @@ -125,6 +132,10 @@

CommandBox commandBox = new CommandBox(this::executeCommand);
commandBoxPlaceholder.getChildren().add(commandBox.getRoot());

File iconFile = new File(iconPath);
Image iconImage = new Image(iconFile.toURI().toString());
iconImageView.setImage(iconImage);

Check warning on line 138 in src/main/java/seedu/address/ui/MainWindow.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/ui/MainWindow.java#L136-L138

Added lines #L136 - L138 were not covered by tests
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/ui/UiManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class UiManager implements Ui {
public static final String ALERT_DIALOG_PANE_FIELD_ID = "alertDialogPane";

private static final Logger logger = LogsCenter.getLogger(UiManager.class);
private static final String ICON_APPLICATION = "/images/address_book_32.png";
private static final String ICON_APPLICATION = "/images/icon_title.png";

private final Logic logic;
private MainWindow mainWindow;
Expand Down
Binary file added src/main/resources/images/icon.png
Loading
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_title.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/main/resources/view/DarkTheme.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
-fx-opacity: 1;
}

.title_label {
-fx-font-family: "Segoe UI Semibold";
-fx-font-size: 21px;
-fx-text-fill: white;
}

.text-field {
-fx-font-size: 12pt;
-fx-font-family: "Segoe UI Semibold";
Expand Down
36 changes: 26 additions & 10 deletions src/main/resources/view/MainWindow.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@
<?import javafx.scene.control.Menu?>
<?import javafx.scene.control.MenuBar?>
<?import javafx.scene.control.MenuItem?>
<?import javafx.scene.control.SplitPane?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.layout.StackPane?>
<?import javafx.scene.layout.VBox?>

<?import javafx.scene.layout.HBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.image.ImageView?>
<fx:root type="javafx.stage.Stage" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1"
title="AssetBook-3" minWidth="450" minHeight="600" onCloseRequest="#handleExit">
title="AssetBook" minWidth="600" minHeight="800" onCloseRequest="#handleExit">
<icons>
<Image url="@/images/address_book_32.png" />
<Image url="@/images/icon_title.png" />
</icons>
<scene>
<Scene>
Expand All @@ -33,11 +35,26 @@
</Menu>
</MenuBar>

<StackPane VBox.vgrow="NEVER" fx:id="commandBoxPlaceholder" styleClass="pane-with-border">
<HBox styleClass="pane-with-border" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1">
<padding>
<Insets top="5" right="10" bottom="5" left="10" />
<Insets top="10" right="15" bottom="10" left="15" />
</padding>
</StackPane>
<children>
<ImageView fx:id="iconImageView" preserveRatio="true" fitWidth="50" fitHeight="50"/>
<Label fx:id="iconName" text="AssetBook" styleClass="title_label" HBox.hgrow="ALWAYS">
<padding>
<Insets left="12" top="5"/>
</padding>
</Label>
</children>
</HBox>

<VBox fx:id="personList" styleClass="pane-with-border" minWidth="340" prefWidth="340" VBox.vgrow="ALWAYS">
<padding>
<Insets top="10" right="10" bottom="10" left="10" />
</padding>
<StackPane fx:id="personListPanelPlaceholder" VBox.vgrow="ALWAYS"/>
</VBox>

<StackPane VBox.vgrow="NEVER" fx:id="resultDisplayPlaceholder" styleClass="pane-with-border"
minHeight="100" prefHeight="100" maxHeight="100">
Expand All @@ -46,12 +63,11 @@
</padding>
</StackPane>

<VBox fx:id="personList" styleClass="pane-with-border" minWidth="340" prefWidth="340" VBox.vgrow="ALWAYS">
<StackPane VBox.vgrow="NEVER" fx:id="commandBoxPlaceholder" styleClass="pane-with-border">
<padding>
<Insets top="10" right="10" bottom="10" left="10" />
<Insets top="5" right="10" bottom="5" left="10" />
</padding>
<StackPane fx:id="personListPanelPlaceholder" VBox.vgrow="ALWAYS"/>
</VBox>
</StackPane>

<StackPane fx:id="statusbarPlaceholder" VBox.vgrow="NEVER" />
</VBox>
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/view/ResultDisplay.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
<?import javafx.scene.layout.StackPane?>

<StackPane fx:id="placeHolder" styleClass="pane-with-border" xmlns="http://javafx.com/javafx/17"
xmlns:fx="http://javafx.com/fxml/1">
<TextArea fx:id="resultDisplay" editable="false" styleClass="result-display"/>
xmlns:fx="http://javafx.com/fxml/1" minHeight="125">
<TextArea fx:id="resultDisplay" editable="false" wrapText="true" styleClass="result-display"/>
</StackPane>
2 changes: 1 addition & 1 deletion src/test/java/seedu/address/commons/util/AppUtilTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class AppUtilTest {

@Test
public void getImage_exitingImage() {
assertNotNull(AppUtil.getImage("/images/address_book_32.png"));
assertNotNull(AppUtil.getImage("/images/icon_title.png"));
}

@Test
Expand Down