无痕客

落花无情,流水无痕……

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

 WizardDialog 默认弹出不居中,下面是让其居中的代码

  WizardDialog dlg = new WizardDialog(Display.getCurrent().getActiveShell(), new ScanWizard());
  dlg.setPageSize(560, 320);
  dlg.create();
        //设置窗口自动居中
        Rectangle screenSize = Display.getDefault().getClientArea();
        Shell shell =dlg.getShell();
        shell.setLocation((screenSize.width - dlg.getShell().getBounds().width) / 2,(
                screenSize.height -dlg.getShell().getBounds().height) / 2);
  dlg.open();

posted on 2012-03-07 19:53  无痕客  阅读(1212)  评论(0编辑  收藏  举报