Reputation: 1954
Okay so I've successfully created a modal JDialog
and I used Netbeans GUI Builder to create panels to speed up the design. However, the modal JDialog
doesn't show the panels it has, therefore empty. I don't know what to do next and I don't see any reason why it won't show up if the main container does show.
JDialog
is expected to come up after 2 mouse clicks on JTable
What comes up is this.
instead of this (Update Curriculum Gui), below.
private void curriculumListJtblMouseClicked(java.awt.event.MouseEvent evt) {
int clickCount = evt.getClickCount();
if (clickCount == 2) {
UpdateCurriculumGui updateCurriculum = new UpdateCurriculumGui();
updateCurriculum.setPreferredSize(new Dimension(1000, 650));
updateCurriculum.setVisible(true);
updateCurriculum.pack();
updateCurriculum.setLocationRelativeTo(null);
}
}
UpdateCurriculumGui on it's own class.
public class UpdateCurriculumGui extends javax.swing.JDialog {
public UpdateCurriculumGui() {
super(null, ModalityType.MODELESS);
setAlwaysOnTop(true);
setTitle("Update Curriculum Information");
}
}
I hope you can help me because I haven't tried to use JDialogs before. I'd appreciate any suggestions.
Thanks.
Upvotes: 0
Views: 593
Reputation: 3454
you have to fill your dialog with content!
public class UpdateCurriculumGui extends javax.swing.JDialog {
public UpdateCurriculumGui() {
super(null, ModalityType.APPLICATION_MODAL);
//setAlwaysOnTop(true); set modal instead
setTitle("Update Curriculum Information");
add(new JLabel("i'm content!")); //this is content!
}
}
see Dialog.ModalityType for details on MODELESS
(shouldn't it be APPLICATION_MODAL
?)
Upvotes: 1