随笔-88  评论-77  文章-48  trackbacks-0
    /**
     * 方法名称: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 崛起的程序员 阅读(316) 评论(1)  编辑  收藏 所属分类: java

评论:
# re: SWT技巧荟萃1-设置居中 2006-11-22 17:36 | Tom[匿名]
谢谢  回复  更多评论
  

只有注册用户登录后才能发表评论。


网站导航: