簡體   English   中英

JTextArea中的自動結束行

[英]auto end line in JTextArea

我有一個帶長字符串的jTextArea。
我們來了:

String str = "this is a toooo long string";

現在我想在一個swing jTextArea中顯示這個字符串。 但是我的textArea在框架上的尺寸有限。 所以,我無法看到整個字符串。
例如,文本區域僅顯示:
“這是在”

textarea可以避免隱藏字符自動引入'\\ n'? 注意:我不想自動scrool。

謝謝

JTextArea textArea = new JTextArea(
    "This is an editable JTextArea. " +
    "A text area is a \"plain\" text component, " +
    "which means that although it can display text " +
    "in any font, all of the text is in the same font."
);
textArea.setFont(new Font("Serif", Font.ITALIC, 16));
textArea.setLineWrap(true);
textArea.setWrapStyleWord(true);

摘自: http//download.oracle.com/javase/tutorial/uiswing/components/textarea.html

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM