A useful dialog box

xiaoxiao2021-03-06  39

/ / Make the function of the dialog box, will not be different due to the difference in resolution

Public Static Void SetLocation (JDIALOG DIALOG) {

Dimension Screensize = Toolkit.getDefaultToolkit (). GetScreensize ();

Dimension framesize = dialog.getsize ();

IF (framesis.height> screensize.height) {

Framesize.height = screensize.height;

}

IF (framesis.width> screensize.width) {

Framesize.width = screensize.width;

}

Dialog.setLocation (Screensize.width - Framesize.width) / 2,

Screensize.height - framesis.height) / 2);

}

// To call this function, just use in Dialog

JBGLobal.SetLocation (this);

// JBGLOBAL is a full class, but also pay attention to the above statement

This.Setsize (New Dimension (500, 395));

// Next, the dialog will not be in place.

转载请注明原文地址:https://www.9cbs.com/read-70192.html

New Post(0)