简体   繁体   English

如何在draw2d TextFlow中添加强制换行

[英]How to add a force line-break in a draw2d TextFlow

How do I add a forced line-break within a draw2d TextFlow figure. 如何在draw2d TextFlow图中添加强制换行符。

I build a IFigure by adding several different objects. 我通过添加几个不同的对象来构建IFigure Amongst other things I add a FlowPage containing a TextFlow . 除其他外,我添加一个包含TextFlowFlowPage But I could not find an option to force line-breaks at specific locations. 但是我找不到在特定位置强制换行的选项。

Figure fig = new Figure();
fig.setLayoutManager(new FreeformLayout());

FlowPage flow = new FlowPage();
flow.setSize(100,100);

TextFlow text = new textFlow("A rather long text without any line-breaks. Lorem Ipsum dolor sit amet.");

flow.add(text);
fig.add(flow);
fig.setSite(100,100);

The common LineFeed character \\n solved this problem. 常见的LineFeed字符\\n解决了此问题。 Inserted somewhere inside the String it forces a line-break. 插入字符串内的某个位置会强制换行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM