File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
src/java.desktop/share/classes/java/awt Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change 11/*
2- * Copyright (c) 1999, 2025 , Oracle and/or its affiliates. All rights reserved.
2+ * Copyright (c) 1999, 2026 , Oracle and/or its affiliates. All rights reserved.
33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44 *
55 * This code is free software; you can redistribute it and/or modify it
@@ -459,6 +459,9 @@ private static void checkKeycodeArgument(int keycode) {
459459 * @return Color of the pixel
460460 */
461461 public synchronized Color getPixelColor (int x , int y ) {
462+ // need to sync the toolkit prior to grabbing the pixels since in some
463+ // cases rendering to the screen may be delayed
464+ Toolkit .getDefaultToolkit ().sync ();
462465 Point point = peer .useAbsoluteCoordinates () ? toDeviceSpaceAbs (x , y )
463466 : toDeviceSpace (x , y );
464467 return new Color (peer .getRGBPixel (point .x , point .y ));
You can’t perform that action at this time.
0 commit comments