I have problem with displaying modal dialog and busy cursor at the same time.
I display a modal dialog and set the cursor of the main frame on “waiting state”. Everything is fine, except that if the mouse exits the main frame and enters again, it never comes back on “waiting state”. This bug (?) doesn’t happen if the dialog is not modal.
The test program:
public static void main(String[] args) {
final JFrame frame = new JFrame();
frame.setSize(new Dimension(500, 500));
final JDialog dialog = new JDialog(frame);
dialog.setModal(true);
frame.add(new JButton(new AbstractAction("Dialog") {
@Override
public void actionPerformed(ActionEvent e) {
frame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
dialog.setVisible(true);
}
}));
frame.setVisible(true);
}
Cursoris possibe to change (or change is visible) for window that have gotfocus, this is basic properties for Modal window or forModalityTypes,after child
JDialogis closed, thenJFramecould be changedCursortoWAIT_CURSORyou to visible the changed
Cursorby removingsetModal()or to change changingModalityTypes to theModalityType.MODELESS