Skip to content

Commit

Permalink
feat(ShareComponent): Create for loop and arraylist for easier style …
Browse files Browse the repository at this point in the history
…setting
  • Loading branch information
danieskj committed May 14, 2026
1 parent 5b93da8 commit 0af42f9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
import javafx.scene.control.Label;
import javafx.scene.layout.HBox;

import java.util.ArrayList;
import java.util.Collections;


public class ShareComponent extends HBox {

Expand All @@ -21,10 +24,9 @@ public ShareComponent(Share share){
Label ticker = new Label("("+share.getStock().getSymbol()+")");
Label latestPrice = new Label("Latest price: "+share.getStock().getSalesPrice().toString());
Button sellButton = new Button("Sell");
ticker.getStyleClass().add("portfolio-box-text");
name.getStyleClass().add("portfolio-box-text");
quantity.getStyleClass().add("portfolio-box-text");
latestPrice.getStyleClass().add("portfolio-box-text");
ArrayList<Label> labels = new ArrayList<>();
Collections.addAll(labels, name, quantity, ticker, latestPrice);
labels.forEach(e -> e.getStyleClass().add("portfolio-box-text"));
sellButton.getStyleClass().add("button");
String color = CssUtils.generateValueColors(share.getProfit().doubleValue());
CssUtils.apply(latestPrice, color);
Expand Down
3 changes: 1 addition & 2 deletions src/main/resources/themes/default.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
-fx-background-color: #3B8C6E;
}


.title {
-fx-font-size: 56px;
-fx-font-weight: 700;
Expand Down Expand Up @@ -92,7 +91,7 @@
}

.rowBox {
-fx-background-color: #A9A9A9;
-fx-background-color: #404950;
-fx-alignment: center;
}

Expand Down

0 comments on commit 0af42f9

Please sign in to comment.