我需要一个文本弹出,就像你得到的那样JOptionPane.showInputDialog(null, "Text");只是有多行,比如......
I'm new to java.
I have no background in programming.
I could use some help
Run Code Online (Sandbox Code Playgroud)
我该怎么做?
Dav*_*amp 17
您可以像这样使用'\n':
JOptionPane.showMessageDialog(null, "Hello\nworld");
Run Code Online (Sandbox Code Playgroud)
Mad*_*mer 15
可能有十几种其他方法可以做到这一点,但我能想到的最简单的方法是
JOptionPane.showMessageDialog(null, "<html>I'm new to java.<br>I have no background in programming.<br>I could use some help Thanks!</html>");
Run Code Online (Sandbox Code Playgroud)
另一种证明力量的方法 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);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
38500 次 |
| 最近记录: |