0

When money label (into the moneyBox) has no more than 5 digits everything is fine, but when money is increasing the design is going to be messy. How can I fix it?

    StackPane bottom = new StackPane();
    VBox vboxBottom = new VBox();
    HBox hboxBottomElements = new HBox(15);
    HBox hboxBottomMain = new HBox(0);

    hboxBottomElements.getChildren().addAll(visaLabel, separator2, adLabel, separator3, governRelationStatus, separator4, christianityLabel);
    hboxBottomElements.setPadding(new Insets(5));

    vboxBottom.getChildren().addAll(season, separator1, hboxBottomElements);
    vboxBottom.setPadding(new Insets(30,0,0,0));

    bottom.getChildren().addAll(vboxBottom, next);
    StackPane.setAlignment(next, Pos.BOTTOM_RIGHT);
    StackPane.setMargin(next, new Insets(0,0,0,999));
    hboxBottomMain.getChildren().addAll(moneyBox, bottom);

    layout.setBottom(hboxBottomMain);

Before

After

Hasan Shans
  • 57
  • 11
  • 1
    Using `false` for the `wrapText` property should result in a ellipsis instead of a line break. I've no idea, if this is the desired behavior since you do not describe the desired behavior... Also note that it's hard to get the scene structure from code especially, if half of the nodes are created/declared somewhere outside the code snippet. Consider creating a fxml file creating the necessary node structure to reproduce the problem... – fabian Feb 27 '17 at 16:58
  • Here is the solution : http://stackoverflow.com/questions/42599738/java-fx-out-of-the-window-screen?noredirect=1#comment72330340_42599738 – Hasan Shans Mar 27 '17 at 15:38

1 Answers1

0

One thing you could do is change the way money is displayed when it gets that large.

You have 10,000,000$ you are trying to display. You may be able to change that to say 10m$ where M is million. Then, when you get to 1,000m, you could change it to 1b, etc..

I'm not sure how you get this number, but it can be achieved by some simple arithmatic. i.e..

if(money > 9,999,999){
    displayMoney = money/1,000,000.00;
    displayMoneyString = displayMoney + "m$";
}

So something like that to remove some unneccessary or large numbers,

Hope this helps.

Hypnic Jerk
  • 1,192
  • 3
  • 14
  • 32