I have a label and when setting the text I want to change line . For instance
String str=\"first line \\n Secondline \";
JLabel label.setText(str);
<
Swing does not uses classical line breaks. Instead, for a reason I never fully understood, it uses HTML 3.2. As a consequence, to have your text correctly displayed, yopu have to rely upon HTML content :
String str= "First line
Second line"
However, if you really want to, there are other possibilities ...