0

嘿,所以我按下按钮并出现一个消息框,名为“消息”。我如何重命名这个标题?

寻找这个,但没有找到任何地方。

这就是我创建一个按钮然后激活它以便弹出消息的方式。没有粘贴整个代码,因为它很长,但这就是这个按钮。

private JButton readmeButton;

readmeButton = new JButton("Readme");
layout.setConstraints(readmeButton, constraints);
chartPanel.add(readmeButton);
readmeButton.addActionListener(this);

JOptionPane.showMessageDialog(null, "lalala");
4

3 回答 3

2

JOptionPane.showMessageDialog有多个重载。其中之一是showMessageDialog(Component parentComponent, Object message, String title, int messageType)

你可以使用这个:

JOptionPane.showMessageDialog(null, "lalala", "title", JOptionPane.PLAIN_MESSAGE);

最后一个参数的其他选项是ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE, QUESTION_MESSAGE.

于 2012-12-15T10:35:14.357 回答
0

在你的代码中试试这个:

JOptionPane.showMessageDialog(null, "Hello","Exit",JOptionPane.QUESTION_MESSAGE);
于 2013-10-17T07:19:37.707 回答
0

利用

JOptionPane.showMessageDialog(null, "lalala","Readme",JOptionPane.PLAIN_MESSAGE);

参考

在上面的链接上,还有许多其他选项。看看它。

于 2012-12-15T10:44:01.463 回答