Moçada, consegui da seguinte forma:
Cadastro.java //Meu JInternalFrame
import registro.*; //Pacote onde está os JDialog's
...
private JDialog frame;
...
private JButton getJButton() {
if (jButton == null) {
jButton = new JButton();
jButton.setBounds(new Rectangle(164, 174, 23, 22));
jButton.addActionListener(this);
}
}
...
public void actionPerformed(ActionEvent e) {
if(e.getSource() == jButton){
frame = new dialog(); //dialog é um JDialog do pacote registro
frame.setVisible(true);
}
}
dialog.java //Minha JDialog do pacote registro
package registros;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import javax.swing.JDialog;
import java.awt.Point;
public class dialog extends JDialog {
private static final long serialVersionUID = 1L;
private JPanel jContentPane = null;
public dialog() {
super();
initialize();
}
private void initialize() {
this.setSize(420, 366);
this.setLocation(new Point(300, 200));
this.setResizable(false);
this.setModal(true); //Perceba que ela tem que estar com setModal(true)
this.setTitle("Registro");
this.setContentPane(getJContentPane());
}
private JPanel getJContentPane() {
if (jContentPane == null) {
jContentPane = new JPanel();
jContentPane.setLayout(new BorderLayout());
}
return jContentPane;
}
}
Observação: O meu jInternalFrame é um filho de um JFrame.
O JDialog deve estar com setModal(true).
É isso pessoal, espero ter contruibuído e se alguém tiver dificuldade posta aqui…