我正在使用包含 TextFlow 对象的 FlowPage 对象绘制多行文本标签。我的标签类的代码是:
class TransitionLabel extends FlowPage {
private TextFlow content;
public TransitionLabel()
{
setForegroundColor(ColorConstants.white);
setHorizontalAligment(PositionConstants.CENTER);
content = new TextFlow();
content.setOpaque(true);
content.setText("");
add(content);
}
public void setText(String content)
{
this.content.setText(content);
revalidate();
repaint();
}
public String getText()
{
return this.content.getText();
}
}
当控件刷新(修改后)时,它会像下面屏幕截图中的 SEND 标签一样结束。
难道我做错了什么?谢谢你的帮助
PS相同的截图可以在这里找到
PPS 我编辑了getPreferredSize
与问题无关的方法