2

我已经JTextArea用 setText 函数设置了文本

abc="PREFIX table: <http://www.daml.org/2003/01/periodictable/PeriodicTable#> " +
            "SELECT ?name " +
            "FROM <http://www.daml.org/2003/01/periodictable/PeriodicTable.owl>" +
            "WHERE {" +
            "      ?element table:name ?name. " +
            "      FILTER(str(?name)=\"sodium\") " +
            "      }"
texta.setText(abc);//abc is very long string

如何在JTextArea.

4

2 回答 2

2
abc="PREFIX table: <http://www.daml.org/2003/01/periodictable/PeriodicTable#>\n" +
        "SELECT ?name\n" +
        "FROM <http://www.daml.org/2003/01/periodictable/PeriodicTable.owl>\n" +
        "WHERE {\n" +
        "      ?element table:name ?name.\n" +
        "      FILTER(str(?name)=\"sodium\")\n" +
        "      }"

那应该行得通。

于 2011-04-12T17:56:08.583 回答
1

在您的字符串中使用新行。'\n'性格。

于 2011-04-12T17:56:43.053 回答