cancel
Showing results for 
Search instead for 
Did you mean: 

Centre a popup window

Former Member
0 Kudos

Hi,

I’m trying to put in the centre of the screen a popup window using the following code:

IWDWindowInfo windowInfo = (IWDWindowInfo)wdComponentAPI.

getComponentInfo().findInWindows("Test");

IWDWindow window =wdComponentAPI. getWindowManager().

createWindow (windowInfo, true);

Dimension auxDimension = java.awt.Toolkit.

getDefaultToolkit(). getScreenSize();

int initialH = new Double(auxDimension.getWidth()).intValue();

int initialW = new Double (auxDimension.getHeight()).intValue();

window.setWindowPosition((initialH-200)/2,(initialW-50)/2);

but the code line

Dimension auxDimension = java.awt.Toolkit.

getDefaultToolkit(). getScreenSize();

throws an java.awt.HeadlessException exception

Then, How can I put in the centre of the screen a popup window?

Thanks,

Ricard.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Use the following code:

window.setWindowPosition(WDWindowPos.CENTER);

Kind Regards,

S.Saravanan.

Answers (0)