-
Bug
-
Resolution: Unresolved
-
P4
-
8u91, 9
-
x86
-
other
FULL PRODUCT VERSION :
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
OSX 10.11.3 and 10.11.4 El Capitan
EXTRA RELEVANT SYSTEM CONFIGURATION :
Does NOT occur on window systems
A DESCRIPTION OF THE PROBLEM :
After closing a modal dialog all mouse cursors disappear.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
The code for test case exists in a JFrame containing two panels in a Splitpane and a button to open a modal dialog. When you move the mouse over the different components you see different mouse cursors.
After clicking the button to open a modal dialog and close it with its close button, the mouse cursors all disappear respectively the default cursor is shown.
This behavior is only on Mac OSX systems on window systems the bahavior is correct
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
After closing the modal dialog should all cursors be shown as before
ACTUAL -
After closing the modal dialog in all components is shown the default cursor
ERROR MESSAGES/STACK TRACES THAT OCCUR :
No error messages.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSplitPane;
public class TestCursor extends JFrame
{
public TestCursor()
{
setLayout(new BorderLayout());
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
final JPanel panel1 = new JPanel();
panel1.setPreferredSize(new Dimension(200,400));
panel1.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
final JPanel panel2 = new JPanel();
panel2.setPreferredSize(new Dimension(200,400));
panel2.setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
final JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, panel1, panel2);
this.add(splitPane, BorderLayout.CENTER);
final JButton button = new JButton("Open Dialog");
button.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(final ActionEvent e)
{
openDialog(panel1);
}
});
this.add(button, BorderLayout.SOUTH);
}
protected void openDialog(final Component comp)
{
final JDialog infoDialog = new JDialog(this, "Dialog");
infoDialog.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
infoDialog.setLayout(new BorderLayout());
final JLabel htmlPane = new JLabel();
htmlPane.setText("Any Text");
infoDialog.add(htmlPane, BorderLayout.CENTER);
final JButton closeButton = new JButton("Close");
closeButton.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(final ActionEvent e)
{
infoDialog.setVisible(false);
infoDialog.dispose();
}
});
infoDialog.add(closeButton, BorderLayout.SOUTH);
infoDialog.setModal(true);
infoDialog.pack();
infoDialog.setLocationRelativeTo(comp);
infoDialog.setVisible(true);
}
public static void main(final String[] args)
{
final TestCursor frame = new TestCursor();
frame.pack();
frame.setVisible(true);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
If you move the cursor outside the JFrame window and move back the mouse cursors are shown again
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
OSX 10.11.3 and 10.11.4 El Capitan
EXTRA RELEVANT SYSTEM CONFIGURATION :
Does NOT occur on window systems
A DESCRIPTION OF THE PROBLEM :
After closing a modal dialog all mouse cursors disappear.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
The code for test case exists in a JFrame containing two panels in a Splitpane and a button to open a modal dialog. When you move the mouse over the different components you see different mouse cursors.
After clicking the button to open a modal dialog and close it with its close button, the mouse cursors all disappear respectively the default cursor is shown.
This behavior is only on Mac OSX systems on window systems the bahavior is correct
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
After closing the modal dialog should all cursors be shown as before
ACTUAL -
After closing the modal dialog in all components is shown the default cursor
ERROR MESSAGES/STACK TRACES THAT OCCUR :
No error messages.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSplitPane;
public class TestCursor extends JFrame
{
public TestCursor()
{
setLayout(new BorderLayout());
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
final JPanel panel1 = new JPanel();
panel1.setPreferredSize(new Dimension(200,400));
panel1.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
final JPanel panel2 = new JPanel();
panel2.setPreferredSize(new Dimension(200,400));
panel2.setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
final JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, panel1, panel2);
this.add(splitPane, BorderLayout.CENTER);
final JButton button = new JButton("Open Dialog");
button.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(final ActionEvent e)
{
openDialog(panel1);
}
});
this.add(button, BorderLayout.SOUTH);
}
protected void openDialog(final Component comp)
{
final JDialog infoDialog = new JDialog(this, "Dialog");
infoDialog.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
infoDialog.setLayout(new BorderLayout());
final JLabel htmlPane = new JLabel();
htmlPane.setText("Any Text");
infoDialog.add(htmlPane, BorderLayout.CENTER);
final JButton closeButton = new JButton("Close");
closeButton.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(final ActionEvent e)
{
infoDialog.setVisible(false);
infoDialog.dispose();
}
});
infoDialog.add(closeButton, BorderLayout.SOUTH);
infoDialog.setModal(true);
infoDialog.pack();
infoDialog.setLocationRelativeTo(comp);
infoDialog.setVisible(true);
}
public static void main(final String[] args)
{
final TestCursor frame = new TestCursor();
frame.pack();
frame.setVisible(true);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
If you move the cursor outside the JFrame window and move back the mouse cursors are shown again