0
我是javafx的新手。文本对齐在TextFlow上不起作用
我正在尝试构建一个聊天面板显示消息的聊天工具。 我想对齐消息,就像我自己的消息在左边,其他消息在右边。
要显示我正在使用TextFlow添加文本的消息。但对齐不起作用。
TextFLow tf=new TextFlow();
Text t1= new Text("Hi");
Text t2= new Text("Hello");
t1.setTextAlignment(TextAlignment.RIGHT);
t2.setTextAlignment(TextAlignment.LEFT);
tf.getChildren().addAll(t1,t2);
但对齐不起作用。这两个文本都在左边。 我该怎么办?