boolean (Object component, Object part) { Rectangle view = getRectangle(component, ":view"); Rectangle port = ((part == "left") || (part == "up")) ? null : getRectangle(component, ":port"); int dx = 0; int dy = 0; if (part == "left") { dx = -10; } else if (part == "lefttrack") { dx = -port.width; } else if (part == "right") { dx = 10; } else if (part == "righttrack") { dx = port.width; } else if (part == "up") { dy = -10; } else if (part == "uptrack") { dy = -port.height; } else if (part == "down") { dy = 10; } else if (part == "downtrack") { dy = port.height; } if (dx != 0) { dx = (dx < 0) ? Math.max(-view.x, dx) : Math.min(dx, view.width - port.width + 2 - view.x); } else if (dy != 0) { dy = (dy < 0) ? Math.max(-view.y, dy) : Math.min(dy, view.height - port.height + 2 - view.y); } else { return false; } view.x += dx; view.y += dy; repaint(component, null, (dx != 0) ? "horizontal" : "vertical"); return (((part == "left") || (part == "lefttrack")) && (view.x > 0)) || (((part == "right") || (part == "righttrack")) && (view.x < view.width - port.width + 2)) || (((part == "up") || (part == "uptrack")) && (view.y > 0)) || (((part == "down") || (part == "downtrack")) && (view.y < view.height - port.height + 2)); }