Skip to content
Snippets Groups Projects
Commit 62fdfbf1 authored by Harry Linrui XU's avatar Harry Linrui XU
Browse files

"Balance field becomes red if expenses exceeds limit"

parent b3002fa9
No related branches found
No related tags found
10 merge requests!43Merging frontend-testing into master,!38"Made progressbar dynamic in accordance to spending. Added balance field....,!37Made the sub progress bars respond to changes in expense,!32Added input validation to add dialog boxes.,!30Redesigned scenes,!29Redesigned scenes,!28Redesigned scenes,!26Redesigned Main menu and expense/income windows,!24Merging frontend-testing with master,!23Merging frontend-testing and master
......@@ -12,6 +12,7 @@ import javafx.scene.control.DatePicker;
import javafx.scene.control.Label;
import javafx.scene.control.ProgressBar;
import javafx.scene.image.ImageView;
import javafx.scene.paint.Color;
import javafx.scene.text.Text;
import javafx.stage.Stage;
import no.ntnu.idatt1002.demo.data.Economics.ExpenseRegister;
......@@ -45,7 +46,7 @@ public class MainMenuController {
private Text budgetMonth;
@FXML
private Label balance;
private Label balanceLbl;
@FXML
public void initialize() throws IOException {
......@@ -62,7 +63,12 @@ public class MainMenuController {
today.setTranslateX(-275 + progressbar.getProgress());
budgetMonth.setText("BUDGET " + (LocalDate.EPOCH.getMonth()));
balance.setText("Balance: " + (incomeRegister.getTotalSum() - expenseRegister.getTotalSum()));
double balance = incomeRegister.getTotalSum() - expenseRegister.getTotalSum();
balanceLbl.setText("Balance: " + (balance));
if (balance < 0) {
balanceLbl.setTextFill(Color.RED);
}
}
@FXML
......
......@@ -48,7 +48,7 @@
<DatePicker fx:id="date" />
<HBox alignment="BOTTOM_CENTER" prefHeight="28.0" prefWidth="574.0">
<children>
<Label fx:id="balance" text="Balance:" textAlignment="CENTER">
<Label fx:id="balanceLbl" text="Balance:" textAlignment="CENTER">
<font>
<Font name="System Bold" size="24.0" />
</font></Label>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment