-6

I have a small question in one of the topics from Swing in Java. I was trying to create a dialog box with:

  1. label & a combo box (e.g.: gender:M/F) and
  2. label & a text field (e.g.: what's your name:text field).

I want all the things in the same dialog-box. Can anyone tell me how to approach the issue?

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
user1957902
  • 37
  • 3
  • 5
  • 5
    What did you tried? Show some efforts guy or no one will help. – Harry Joy Jan 08 '13 at 11:32
  • 1
    Please have a look at [Customize JOptionPane Dialog](http://stackoverflow.com/a/12235299/1057230) and one more [example](http://stackoverflow.com/a/10309277/1057230) for the same. – nIcE cOw Jan 08 '13 at 12:06

1 Answers1

2

You can add the component to a JPanel, then add the panel in the dialog.

Refer to this tutorial.

AsirC
  • 449
  • 1
  • 6
  • 20
  • 4
    Please add a brief description and perhaps a snippet of the useful code from that site. If that site changes its content or is taken offline this answer loses all use. Thanks – RhysW Jan 08 '13 at 11:36