package GaoJiLei;
import javax.swing.*;
import java.awt.Dimension;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.event.*;
public class CenteredFrameTest {
public static void main(String[]args){
CenteredFrame frame=new CenteredFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
class CenteredFrame extends JFrame {
public CenteredFrame(){
Toolkit kit=Toolkit.getDefaultToolkit();
Dimension screenHight=kit.getScreenSize();
int screenHeight=screenSize.height;
int screenWidth=screenSize.width;
setSize(screenWidth/2,screenHeight/2);
setLocation(screenWidth/4,screenWidth/4);
Image img=kit.getImage("icon.gif");
setIconImage(img);
setTitle("CenteredFrame");
}
}
int screenHeight=screenSize.height; int screenWidth=screenSize.width;这两句为啥报错呢?!
答案:2 悬赏:80 手机版
解决时间 2021-02-16 08:07
- 提问者网友:别再叽里呱啦
- 2021-02-15 08:58
最佳答案
- 五星知识达人网友:一把行者刀
- 2021-02-15 10:13
{ g.setColor(Color.black) ; g.drawRect(0,0,360,600) ; g.setColor(Color.pink) ; for(int i=0;i<=360;i=i+30) g.drawLine(i,0,i,
全部回答
- 1楼网友:轻雾山林
- 2021-02-15 11:13
你说呢...
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯