838 public Dimension getBestCursorSize(int preferredWidth, int preferredHeight) { 839 return new Dimension(WCustomCursor.getCursorWidth(), 840 WCustomCursor.getCursorHeight()); 841 } 842 843 @Override 844 public native int getMaximumCursorColors(); 845 846 static void paletteChanged() { 847 ((Win32GraphicsEnvironment)GraphicsEnvironment 848 .getLocalGraphicsEnvironment()) 849 .paletteChanged(); 850 } 851 852 /* 853 * Called from Toolkit native code when a WM_DISPLAYCHANGE occurs. 854 * Have Win32GraphicsEnvironment execute the display change code on the 855 * Event thread. 856 */ 857 public static void displayChanged() { 858 EventQueue.invokeLater(new Runnable() { 859 @Override 860 public void run() { 861 ((Win32GraphicsEnvironment)GraphicsEnvironment 862 .getLocalGraphicsEnvironment()) 863 .displayChanged(); 864 } 865 }); 866 } 867 868 /** 869 * create the peer for a DragSourceContext 870 */ 871 872 @Override 873 public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException { 874 final LightweightFrame f = SunToolkit.getLightweightFrame(dge.getComponent()); 875 if (f != null) { 876 return f.createDragSourceContextPeer(dge); 877 } 878 879 return WDragSourceContextPeer.createDragSourceContextPeer(dge); 880 } 881 882 @Override 883 @SuppressWarnings("unchecked") 884 public <T extends DragGestureRecognizer> T 885 createDragGestureRecognizer(Class<T> abstractRecognizerClass, | 838 public Dimension getBestCursorSize(int preferredWidth, int preferredHeight) { 839 return new Dimension(WCustomCursor.getCursorWidth(), 840 WCustomCursor.getCursorHeight()); 841 } 842 843 @Override 844 public native int getMaximumCursorColors(); 845 846 static void paletteChanged() { 847 ((Win32GraphicsEnvironment)GraphicsEnvironment 848 .getLocalGraphicsEnvironment()) 849 .paletteChanged(); 850 } 851 852 /* 853 * Called from Toolkit native code when a WM_DISPLAYCHANGE occurs. 854 * Have Win32GraphicsEnvironment execute the display change code on the 855 * Event thread. 856 */ 857 public static void displayChanged() { 858 Runnable runnable = () -> 859 ((Win32GraphicsEnvironment) GraphicsEnvironment 860 .getLocalGraphicsEnvironment()).displayChanged(); 861 if (AppContext.getAppContext() == null) { 862 new Thread(null, runnable, "displayChanged", 0, false).start(); 863 } else { 864 EventQueue.invokeLater(runnable); 865 } 866 } 867 868 /** 869 * create the peer for a DragSourceContext 870 */ 871 872 @Override 873 public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException { 874 final LightweightFrame f = SunToolkit.getLightweightFrame(dge.getComponent()); 875 if (f != null) { 876 return f.createDragSourceContextPeer(dge); 877 } 878 879 return WDragSourceContextPeer.createDragSourceContextPeer(dge); 880 } 881 882 @Override 883 @SuppressWarnings("unchecked") 884 public <T extends DragGestureRecognizer> T 885 createDragGestureRecognizer(Class<T> abstractRecognizerClass, |