Buggy code:
boolean runDeferredLayouts ( ) { } boolean runPaint ( ) { } boolean runPopups ( ) { } boolean runSettings ( ) { } boolean runSkin ( ) { } boolean runTimers ( ) { } void sendEvent ( int eventType , Event event ) { } void sendEvent ( EventTable table , Event event ) { } static NSString getApplicationName ( ) { } public static String getAppName ( ) { } public static String getAppVersion ( ) { } public static void setAppName ( String name ) { } public static void setAppVersion ( String version ) { } Runnable hoverTimer = new Runnable ( ) { public void run ( ) { } } ; Runnable caretTimer = new Runnable ( ) { public void run ( ) { } } ; Runnable defaultButtonTimer = new Runnable ( ) { public void run ( ) { } } ; void setCurrentCaret ( Caret caret ) { } void setCursor ( Control control ) { } public void setCursorLocation ( int x , int y ) { } public void setCursorLocation ( Point point ) { } public void setData ( String key , Object value ) { } void setMenuBar ( Menu menu ) { } void setModalDialog ( Dialog modalDialog ) { } void setModalShell ( Shell shell ) { } public void setData ( Object data ) { } public void setSynchronizer ( Synchronizer synchronizer ) { } public boolean sleep ( ) { } int sourceProc ( int info ) { } public void syncExec ( Runnable runnable ) { } public void timerExec ( int milliseconds , Runnable runnable ) { } int timerProc ( int id , int sel , int timerID ) { } public void update ( ) { } void updateDefaultButton ( ) { } void updateQuitMenu ( ) { } public void wake ( ) { } void wakeThread ( ) { } Control findControl ( boolean checkTrim ) { } Control findControl ( boolean checkTrim , NSView [ ] hitView ) { } void finishLaunching ( int id , int sel ) { } void applicationDidBecomeActive ( int id , int sel , int notification ) { } void applicationDidResignActive ( int id , int sel , int notification ) { } int applicationNextEventMatchingMask ( int id , int sel , int mask , int expiration , int mode , int dequeue ) { } void applicationSendTrackingEvent ( NSEvent nsEvent , Control trackingControl ) { } void applicationSendEvent ( int id , int sel , int event ) { NSEvent nsEvent = new NSEvent ( event ) ; NSWindow window = nsEvent . window ( ) ; int type = ( ( int ) ( nsEvent . type ( ) ) ) ; boolean down = false ; switch ( type ) { case OS . NSLeftMouseDown : case OS . NSRightMouseDown : case OS . NSOtherMouseDown : down = true ; case OS . NSLeftMouseUp : case OS . NSRightMouseUp : case OS . NSOtherMouseUp : case OS . NSLeftMouseDragged : case OS . NSRightMouseDragged : case OS . NSOtherMouseDragged : case OS . NSMouseMoved : case OS . NSMouseEntered : case OS . NSMouseExited : case OS . NSKeyDown : case OS . NSKeyUp : case OS . NSScrollWheel : if ( window != null ) { Shell shell = ( ( Shell ) ( getWidget ( window . id ) ) ) ; if ( shell != null ) { Shell modalShell = shell . getModalShell ( ) ; if ( modalShell != null ) { if ( down ) { if ( ! ( application . isActive ( ) ) ) { application . activateIgnoringOtherApps ( true ) ; } <START_BUG> NSRect rect = window . contentRectForFrameRect ( window . frame ( ) ) ; <END_BUG> NSPoint pt = window . convertBaseToScreen ( nsEvent . locationInWindow ( ) ) ; if ( OS . NSPointInRect ( pt , rect ) ) beep ( ) ; } return ; } } } break ; } sendEvent = true ; if ( ( ( ( window != null ) && ( window . isKeyWindow ( ) ) ) && ( ( nsEvent . type ( ) ) == ( OS . NSKeyDown ) ) ) && ( ( ( nsEvent . modifierFlags ( ) ) & ( OS . NSHelpKeyMask ) ) != 0 ) ) { window . sendEvent ( nsEvent ) ; } if ( ( ( ( window != null ) && ( window . isKeyWindow ( ) ) ) && ( ( nsEvent . type ( ) ) == ( OS . NSKeyUp ) ) ) && ( ( ( nsEvent . modifierFlags ( ) ) & ( OS . NSCommandKeyMask ) ) != 0 ) ) { window . sendEvent ( nsEvent ) ; } else { objc_super super_struct = new objc_super ( ) ; super_struct . receiver = id ; super_struct . super_class = OS . objc_msgSend ( id , sel_superclass ) ; OS . objc_msgSendSuper ( super_struct , sel , event ) ; } sendEvent = false ; } void applicationWillFinishLaunching ( int id , int sel , int notification ) { } static int applicationProc ( int id , int sel ) { } static int applicationProc ( int id , int sel , int arg0 ) { } static int applicationProc ( int id , int sel , int arg0 , int arg1 ) { } static int applicationProc ( int id , int sel , int arg0 , int arg1 , int arg2 , int arg3 ) { } static int dialogProc ( int id , int sel , int arg0 ) { } static int dialogProc ( int id , int sel , int arg0 , int arg1 ) { } static int dialogProc ( int id , int sel , int arg0 , int arg1 , int arg2 ) { }

Fix:
NSRect rect = window . contentView ( ) . frame ( ) ;