15

私はあなたが得たようなテキストポップアップが必要JOptionPane.showInputDialog(null, "Text");です

I'm new to java.
I have no background in programming.
I could use some help

どうすればいいですか?

4

2 に答える 2

18

次のように '\n' を使用できます。

JOptionPane.showMessageDialog(null, "Hello\nworld");
于 2012-08-25T00:41:27.617 に答える
16

これを行う方法はおそらく他にもたくさんありますが、私が考えることができる最も簡単な方法は

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);

JScrollPane scrollPane = new JScrollPane(msg);

JOptionPane.showMessageDialog(null, scrollPane);
于 2012-08-25T00:40:38.343 に答える