??? /**
???? * 方法名稱:setShell<p>
???? * 方法功能:設置瀏覽器顯示居中和瀏覽器的大小,默認為800*600<p>
???? * 參數說明:Shell<p>
???? * 返回:<p>
???? * 作者:李明
???? * 日期:2006年3月10日
???? */
??? public void setShell(Shell shell)
??? {
??????? shell.setSize(800, 600);
??????? int width = shell.getMonitor().getClientArea().width;
??????? int height = shell.getMonitor().getClientArea().height;
??????? int x = shell.getSize().x;
??????? int y = shell.getSize().y;
??????? if(x > width)
??????? {
??????????? shell.getSize().x = width;
??????? }
??????? if(y > height)
??????? {
??????????? shell.getSize().y = height;
??????? }
??????? shell.setLocation((width - x) / 2, (height - y) / 2);
??? }
posted on 2006-04-28 11:21
崛起的程序員 閱讀(329)
評論(1) 編輯 收藏 所屬分類:
java