I'm looking to implement a custom JDialog (that is modal) to get a number of user inputs. I'm extending JDialog so that I don't get the extra window on my taskbar when I open it.

I want to make it modal, so that when I try to click back on the main application, the modal box in the front flashes because it's requesting the focus.

Here's some code I'm trying to use. Setting the modality type does work, but when i use that line of code, all of the items in my frame go away (or at least don't appear). If I put the modality code after the other components are initialized, they work, but modality doesn't. Any suggestions?

Code:
public class CreateCategoryWindow extends JDialog {
...

public CreateCategoryWindow(...

this.setModalityType(JDialog.ModalityType.APPLICATION_MODAL);

...

}

...

}