Hi,
I am working on a multi-frame application that includes the use of a GLCanvas inside a JFrame. When a modal JDialog is made visible, it renders until the user moves the mouse or presses a key, at which point it vanishes. The only way to get it back is pressing Command-tilde until it reappears.
I am running MacOS X 10.4.4 and Java 1.5 Release 3. I think it used to work with Release 1 and 2, but I have not yet had an opportunity to test it. The problem exists for both JOGL 1.1.1 (and earlier) as well as the latest beta release of JSR 231. The problem does not exist on Windows XP or Linux.
I developed a small test program that demonstrates the bug. When the GLCanvas “gl” is in the JFrame, the dialog invoked by the JButton disappears. It does not matter whether the dialog’s parent is the frame itself, the hidden “null” JFrame, or some other Window. Swap in the GLJPanel gl2, and the dialog problem does not occur.
Anyone aware of this problem, whether it’s a bug in JOGL, and if there are any workarounds?
Thanks,
Corey
import java.awt.;
import java.awt.event.;
import javax.media.opengl.;
import javax.swing.;
public class DialogTest {
public void init() {
GLCanvas gl = new GLCanvas();
GLJPanel gl2 = new GLJPanel();
final JFrame frame = new JFrame(“Test”);
frame.setLayout(new BorderLayout());
frame.add(gl, BorderLayout.CENTER); // SWITCH BETWEEN GL & GL2 TO SEE EFFECT.
JButton button = new JButton(“Dialog”);
frame.add(button, BorderLayout.SOUTH);
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
new JDialog(frame, true).setVisible(true);
}
});
frame.setBounds(100, 100, 500, 500);
frame.setVisible(true);
}
public static void main(String[] args) {
final DialogTest dialogTest = new DialogTest();
SwingUtilities.invokeLater(new Runnable() {
public void run() {
dialogTest.init();
}
});
}
}