Reputation: 213
I was trying to build a custom dialog box using the following code.
public class CustomDialog
{
JTextField firstName;
JButton jb;
public CustomDialog()
{
firstName=new JTextField();
jb= new JButton("Browse");
final JComponent[] inputs = new JComponent[]
{
new JLabel("SDK Path"),firstName,jb
};
JOptionPane.showMessageDialog(null, inputs,
"Enter the SDK Path", JOptionPane.PLAIN_MESSAGE);
}
The result of this code has the textfield followed by button and then OK in vertical manner. I wanted to have the button beside the OK Button. How can I do that??
How can I change OK Command's caption to "Save" ?
Please help me regarding this.
Upvotes: 1
Views: 4008
Reputation: 109823
Yes you can, both issues in your question are descibed in the tutorial about JDialog / JOptionPane
Upvotes: 5