JOptionPane.showMessageDialog(null, "<html>I'm new to java.<br>I have no background in programming.<br>I could use some help Thanks!</html>");
另一种证明 JOptionPane ``` JTextArea msg = new JTextArea("This is a really silly example of what can be achieved with a JOptionPane, but this is going to excese for what you have asked for"); msg.setLineWrap(true); msg.setWrapStyleWord(true);
2条答案
按热度按时间luaexgnf1#
可能还有很多其他方法可以做到这一点,但我能想到的最简单的方法是
另一种证明
JOptionPane
```JTextArea msg = new JTextArea("This is a really silly example of what can be achieved with a JOptionPane, but this is going to excese for what you have asked for");
msg.setLineWrap(true);
msg.setWrapStyleWord(true);
JScrollPane scrollPane = new JScrollPane(msg);
JOptionPane.showMessageDialog(null, scrollPane);
gcuhipw92#
您可以这样使用“\n”: