Preheat oven to 400 degrees. Grease a large square casserole dish with butter. Layer 1/2 of the potatoes into bottom of the prepared casserole dish. Top with the onion, and add the remaining potatoes. Season with salt and pepper to taste. In a medium-size saucepan, melt butter over medium heat. Mix in the flour and salt, and stir constantly with a whisk for one minute. Stir in milk/cream. Cook until mixture has thickened. Stir in cheese all at once, and continue stirring until melted, about 30 to 60 seconds. Pour cheese mixture over the potatoes, sprinkle with paprika and cover the dish with aluminium foil. Bake 1 1/2 hours in the preheated oven.