• Post Reply Bookmark Topic Watch Topic
  • New Topic

Input Box?  RSS feed

 
joe kane
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I want to make a input box with two inputs using JOptionPane,
e.g.
Message Box
___________________________________________
First Name: [____]
Second Name: [____]
___________________________________________
with an information message, how would I do this?
Thanks in advance Joe Kane
 
Fuqiang Zhao
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's easy, use the following code:
JPanel p1 = new JPanel();
p1.add(new JLabel("First Name:"));
p1.add(new JTextField(9)):
JPanel p2 = new JPanel();
p2.add(new JLabel("Second Name:"));
p2.add(new JTextField(9)):
Object[] message = {p1, p2};
JOptionPane.showOptionDialog(null,message,"demo",JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE,null,null,null);
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!