My Java code uses Drag & Drop in JTree, which is interrupted after upgrading from CentOS 6 to CentOS 7. Same hardware, same OpenJDK, same Java code, but different graphics driver. A workaround with setting up the command line kernel "nomodeset" helps, but leads to poor graphics and flicker. Here is an easy way to get around Java:
public static void initUnsupportedCursors() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException
{
String cursors[] = new String[]{
"DnD.Cursor.CopyDrop",
"DnD.Cursor.MoveDrop",
"DnD.Cursor.LinkDrop",
"DnD.Cursor.CopyNoDrop",
"DnD.Cursor.MoveNoDrop",
"DnD.Cursor.LinkNoDrop"
};
List <String> unsupportedCursors = new ArrayList <String>();
for (String c : cursors)
{
try
{
if (Toolkit.getDefaultToolkit().getDesktopProperty(c) == null)
{
throw new Exception("Can't find cursor " + c);
}
}
catch (Exception e)
{
unsupportedCursors.add(c);
}
}
if (!unsupportedCursors.isEmpty())
{
Field propsFiled = Toolkit.class.getDeclaredField("desktopProperties");
propsFiled.setAccessible(true);
Map props = (Map) propsFiled.get(Toolkit.getDefaultToolkit());
for (String unsupportedCursor : unsupportedCursors)
{
System.out.println("Replacing unsupported " + unsupportedCursor + " by " + Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
props.put(unsupportedCursor, Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}
}
}
source
share