Alrighty, so I made a nice Custom NSWindow in Coca-Java that I could drag around and resize. There's only one catch: after dragging it a around enough, I will eventually get it to crash. Here's my stacktrace in Project Builder's debugger:
So, does anyone see what's going on? Here's my drag code for reference:
<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>
public void mouseDragged(NSEvent theEvent)
{
NSPoint currentLocation;
NSPoint newOrigin;
NSRect screenFrame = NSScreen.mainScreen().frame();
windowFrame = this.frame();
if(!lowerRightCorner) <font color = brown>//just dragging</font>
{
<font color = brown>//grab the current global mouse location; we could just as easily get the mouse location </font>
<font color = brown>//in the same way as we do in -mouseDown:</font>
currentLocation = this.convertBaseToScreen(this.mouseLocationOutside OfEventStream());
newOrigin = new NSPoint(currentLocation.x() - initialLocation.x(), currentLocation.y() - initialLocation.y());
<font color = brown>// Don't let window get dragged up under the menu bar</font>
if( (newOrigin.y()+windowFrame.size().height()<font color = blue>+22</font>) > (screenFrame.origin().y()+screenFrame.size().heigh t()) )
{
newOrigin = new NSPoint(newOrigin.x(), screenFrame.origin().y() + (screenFrame.size().height()-windowFrame.size().height()<font color = blue>-22</font>));
}
<font color = brown>//go ahead and move the window to the new location</font>
this.setFrameOrigin(newOrigin);
}
}
</font>[/code]
Thanks in advance,
F-bacher
[ 10-16-2001: Message edited by: Ghoser777 ]
[ 10-16-2001: Message edited by: Ghoser777 ]