1179 eventTarget = delegate; 1180 } 1181 delegateEvent = SwingUtilities.convertMouseEvent(getTarget(), me, eventTarget); 1182 } else if (e instanceof KeyEvent) { 1183 KeyEvent ke = (KeyEvent) e; 1184 delegateEvent = new KeyEvent(getDelegateFocusOwner(), ke.getID(), ke.getWhen(), 1185 ke.getModifiers(), ke.getKeyCode(), ke.getKeyChar(), ke.getKeyLocation()); 1186 } else if (e instanceof FocusEvent) { 1187 FocusEvent fe = (FocusEvent) e; 1188 delegateEvent = new FocusEvent(getDelegateFocusOwner(), fe.getID(), fe.isTemporary()); 1189 } 1190 return delegateEvent; 1191 } 1192 1193 protected void handleJavaMouseEvent(MouseEvent e) { 1194 Component target = getTarget(); 1195 assert (e.getSource() == target); 1196 1197 if (!target.isFocusOwner() && LWKeyboardFocusManagerPeer.shouldFocusOnClick(target)) { 1198 LWKeyboardFocusManagerPeer.requestFocusFor(target, CausedFocusEvent.Cause.MOUSE_EVENT); 1199 } else { 1200 // Anyway request focus to the toplevel. 1201 getWindowPeerOrSelf().requestWindowFocus(CausedFocusEvent.Cause.MOUSE_EVENT); 1202 } 1203 } 1204 1205 /** 1206 * Handler for FocusEvents. 1207 */ 1208 protected void handleJavaFocusEvent(FocusEvent e) { 1209 // Note that the peer receives all the FocusEvents from 1210 // its lightweight children as well 1211 LWKeyboardFocusManagerPeer.getInstance(getAppContext()). 1212 setFocusOwner(e.getID() == FocusEvent.FOCUS_GAINED ? this : null); 1213 } 1214 1215 /** 1216 * All peers should clear background before paint. 1217 * 1218 * @return false on components that DO NOT require a clearRect() before 1219 * painting. 1220 */ 1221 protected final boolean shouldClearRectBeforePaint() { | 1179 eventTarget = delegate; 1180 } 1181 delegateEvent = SwingUtilities.convertMouseEvent(getTarget(), me, eventTarget); 1182 } else if (e instanceof KeyEvent) { 1183 KeyEvent ke = (KeyEvent) e; 1184 delegateEvent = new KeyEvent(getDelegateFocusOwner(), ke.getID(), ke.getWhen(), 1185 ke.getModifiers(), ke.getKeyCode(), ke.getKeyChar(), ke.getKeyLocation()); 1186 } else if (e instanceof FocusEvent) { 1187 FocusEvent fe = (FocusEvent) e; 1188 delegateEvent = new FocusEvent(getDelegateFocusOwner(), fe.getID(), fe.isTemporary()); 1189 } 1190 return delegateEvent; 1191 } 1192 1193 protected void handleJavaMouseEvent(MouseEvent e) { 1194 Component target = getTarget(); 1195 assert (e.getSource() == target); 1196 1197 if (!target.isFocusOwner() && LWKeyboardFocusManagerPeer.shouldFocusOnClick(target)) { 1198 LWKeyboardFocusManagerPeer.requestFocusFor(target, CausedFocusEvent.Cause.MOUSE_EVENT); 1199 } 1200 } 1201 1202 /** 1203 * Handler for FocusEvents. 1204 */ 1205 protected void handleJavaFocusEvent(FocusEvent e) { 1206 // Note that the peer receives all the FocusEvents from 1207 // its lightweight children as well 1208 LWKeyboardFocusManagerPeer.getInstance(getAppContext()). 1209 setFocusOwner(e.getID() == FocusEvent.FOCUS_GAINED ? this : null); 1210 } 1211 1212 /** 1213 * All peers should clear background before paint. 1214 * 1215 * @return false on components that DO NOT require a clearRect() before 1216 * painting. 1217 */ 1218 protected final boolean shouldClearRectBeforePaint() { |