自动换行的draw2d标签

Draw2D里的Label不支持自动换行,虽然可以插入换行符手动换行。用TextFlow和适当的Layout可以实现文字的自动换行。以下代码由sean朋友贡献,原文链接

class LabelEx extends FlowPage {

    private TextFlow contents;

    public LabelEx() {
        this("");
    }

    public LabelEx(String text) {
        contents = new TextFlow();
        contents.setLayoutManager(new ParagraphTextLayout(contents, ParagraphTextLayout.WORD_WRAP_SOFT));
        contents.setText(text);
        add(contents);
    }

    public void setText(String text) {
        contents.setText(text);
    }

    public String getText() {
        return contents.getText();
    }
}

87 thoughts on “自动换行的draw2d标签

  1. Pingback: viagramdtrustser.com
  2. Pingback: hqcialismht.com
  3. Pingback: bolsos gucci de mano
  4. Pingback: topedstoreusa.com
  5. Pingback: 1 seriya
  6. Pingback: bofilm
  7. Pingback: womens zero essential
  8. Pingback: trustedmdstorefy.com
  9. Pingback: LostFilm HD 720
  10. Pingback: kinosmotretonline
  11. Pingback: HDrezka
  12. Pingback: movies hdrezka
  13. Pingback: dorama hdrezka
  14. Pingback: youtube2019.ru
  15. Pingback: cerialest.ru
  16. Pingback: serial
  17. Pingback: filmy-2019-kinokrad
  18. Pingback: kinokrad-2019
  19. Pingback: filmy-kinokrad
  20. Pingback: Kinokrad
  21. Pingback: Watch TV Shows

发表评论