问题描述
我可以将showInputDialog与自定义按钮一起使用,还是可以重命名showInputDialog上的确定和取消按钮。
每个方法。选择一个通常可以让您访问所需的功能级别。在你的情况下,你正在寻找
public static Object showInputDialog(Component parentComponent,
Object message,
字符串标题,
int messageType,
图标图标,
Object [] selectionValues,
Object initialSelectionValue)
在此处查看其javadoc:。注意你不会在这里更改按钮的颜色(因为它们依赖于外观),而是改变它们的文本(通常说得足够,因为你也可以在这里设置左侧对话框上显示的图标)。 / p>
Can i use showInputDialog with my custom buttons or can i rename "OK" and "Cancel" button on showInputDialog.
There are a bunch of variants of each JOptionPane
method. And choosing the one will usually give you access to the desired level of feature. In your case, you're looking for
public static Object showInputDialog(Component parentComponent,
Object message,
String title,
int messageType,
Icon icon,
Object[] selectionValues,
Object initialSelectionValue)
See its javadoc here: JOptionPane#showInputDialog
. notice you won't change here the buttons colors (as they're look-and-feel dependant) but rather change their text (which is generally speaking enough, as you can also here set the icon displayed on dialog left side).
这篇关于带有自定义按钮的JOptionPane showInputDialog的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!