try

package cn.njupt.Swing;


import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Image;
import java.awt.Toolkit;


import javax.swing.ImageIcon;
import javax.swing.JFrame;


@SuppressWarnings("all")
public class SizeFrameTest {

public static void main(String[] args) {
EventQueue.invokeLater(()->{
JFrame frame = new  SizeFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setTitle("tian");
frame.setVisible(true);
});

}
  static class SizeFrame extends JFrame {
Toolkit kit = Toolkit.getDefaultToolkit();
Dimension screenSize = kit.getScreenSize();
int screenHeight = screenSize.height;
int screenWidth = screenSize.width;}

//setSize(screenWidth/2,screenHeight/2);
//setLocationByPlatform(true);


//Image image = new ImageIcon("icon.gif").getImage();
//setIconImage(image);




}



阅读更多
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭