我一般都又一个自己的类:
public class MyLocation{
private MyLocation(){}
public static void location(Component component,double zoon){
int windowWidth=...;//忘了,读取屏幕的宽度
int windowHeight=...;
int x,y,windth,heigth;
.
.
.
component.setSize(windth,heigth);
component.setLocation(x,y);
component.setVisible(true);
}
}