您的位置:首页 > 运维架构

居中弹出窗口(Center pop up windows)

2020-03-06 16:26 1766 查看
import java.awt.Dimension;
import java.awt.Toolkit;
import javax.swing.JFrame;

public static void CenterWindow(JFrame window)
{
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
int screenWidth = (int) screenSize.getWidth();
int screenHeight = (int) screenSize.getHeight();
window.setLocation(screenWidth / 2 - window.getWidth() / 2, screenHeight / 2 - window.getHeight() / 2);
}
[/code]


转载于:https://my.oschina.net/u/1538037/blog/213416

  • 点赞
  • 收藏
  • 分享
  • 文章举报
chiqichen8149 发布了0 篇原创文章 · 获赞 0 · 访问量 232 私信 关注
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: