import java.lang.String;
import javax.swing.JDialog;
import java.awt.Toolkit;
import java.awt.Dimension;
import java.awt.Window;
class test extends JDialog{
test(){
setTile("java示例对话框");
setModal(true);
setSize(150,200);
setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
CenterWindow cWin=new CenterWindow();
cWin.center(this);
show();
}
public static void main(String[] args){
test sjf=new test();
}
}
class CenterWindow{
public void center(Window win){
Toolkit tkit=Toolkit.getDefaultToolkit();
Dimension screenSize=tkit.getScreenSize();
Dimension windowSize=win.getSize();
if (windowSize.height>screenSize.height){
windowSize.height=screenSize.height;
}
if(windowSize.width>screenSize.width){
windowSize.width=screenSize.width;
}
win.setLocation((screenSize.width-windowSize.width)/2,
(screenSize.height-windowSize.height)/2);
}
}
我是在jdk-1_5_0_06-windows-i586-p 中运行的。可是提示。test.java使用或覆盖了已过时的API。提示还说要了解
详细信息。请用—Xlint:deprecation 重新编译。什么意思啊。怎么做啊。请高手指教。谢谢。。。。