Format Text output in JavaFX -
I want to print several lines in front of the user using this code:
Data () () (Dataobies .getOne ()) ++ database.getscand () + + "++ databases. GETH + +" (Datobebase) - & gt; {TilePaneGetBal () "+ Databases .getLs () +" "+ DatabasesGetLast ());});
But as you can see, the end result Not very formatted output:
Is there a way to format columns?
There are several options:
-
The simplest is to use a monospace font where the width of each symbol, including the space Is similar, the most popular courier is new:
text.setFont (font.font ("courier new", 14));
-
As you are providing data in a table format, you can choose to use
< / Li>TableView
instead oftext
> -
Finally, if you are actually like this font and do not want to use
TableView
, you can split your line in 4 linesText in Examples Adjust each text
so that the same lines are related to the other lines. E.g.text t1 = new text (database.eten ()); T1.setMinWidth (100); // adjust according to actual data text t2 = new text (dataobase.getscind ()); T2.setMinWidth (100); // Adjust according to real data text T3 = new text (dataobase .get ts ()); T3.setMinWidth (300); // adjust according to real data text t4 = new text (databases .getLs ()); T4.setMinWidth (300); // adjust according to actual data text t5 = new text (databases .getLast ()); TilePenGet Kids (). AddAll (T1, T2, T3, T4, T5);
Comments
Post a Comment