私はここや他のJavaフォーラムで検索しています。また、それをgoogling、私は私の期待に一致するもの(基本的に改行)は見つかりませんでした。私はこれを達成しました:HTMLなしでJTextPaneで改行してください
public final void messageRoom (String message, Boolean bold, Color color) {
StyledDocument document = new DefaultStyledDocument();
SimpleAttributeSet attributes = new SimpleAttributeSet();
if(bold) {
attributes.addAttribute(StyleConstants.CharacterConstants.Bold, Boolean.TRUE);
}
attributes.addAttribute(StyleConstants.CharacterConstants.Foreground, color);
try {
document.insertString(document.getLength(), message, attributes);
} catch (BadLocationException ex) {
System.out.println("ex");
}
chatArea.setStyledDocument(document);
}
これは私が作成しているチャットルームにメッセージを送信することができます。どのようにして次の行に行くことができますか?
ありがとうございました! (類似していますが、等しくない投稿:First postとThe second one)
これは、StackOverflowの動作方法ではありません。あなたは、質問としてあなたが考え出したクールなものを投稿するだけではありません。あなたの質問には、問題を明確かつ簡潔に、コード例などで記述してください。あなたも答えがあれば、それを質問_とは別に回答_に投稿し、必要な遅れの後に答えを受け入れてください。私たちはタイトルに "SOLVED"を入れておらず、その質問に回答を入れません。 [help]にアクセスし、[ask]と[answer]を読んでください。 –