如何在JOptionPane.messageDialog中打破一个新行 [英] how to break a new line in JOptionPane.messageDialog

查看:102
本文介绍了如何在JOptionPane.messageDialog中打破一个新行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友,我正在做一个程序,可以在java中使用joptionpyne显示一些信息。但是我不知道如何打破文本出现在多行中

例如。

*产品代码:1

*产品:鞋子

*单价:125.90

*折扣:5%

*折扣后支付的总金额: - ----



i想要这样的东西出现

i试过........



JOptionPane.showMessageDialog(null,..........................);

但我不知道怎么打破它出现在多行请帮助。谢谢!!!

解决方案

\ n应该这样做。有时你需要\\\\ n。


你甚至可能需要创建一个自定义的JDialog。



http://docs.oracle.com/javase/tutorial/uiswing/components/dialog.html [ ^ ]



这将指导你。


dear friends i am doing a program that can display the some information using joptionpyne in java. but i don''t know how to break the text to appear in more than one line
for example.
* product code: 1
* product: shoes
* unit price: 125.90
* discount: 5%
* total amount to be paid after discount: ------

i want something like this to appear
i tried........

JOptionPane.showMessageDialog(null,"..........................");
but i dont know how break it to appear in multiple line please help. THANKS!!!

解决方案

\n should do it. Sometime you''ll need \r\n.


maybe you even need to create a custom JDialog.

http://docs.oracle.com/javase/tutorial/uiswing/components/dialog.html[^]

That will guide you.


这篇关于如何在JOptionPane.messageDialog中打破一个新行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆