小编APe*_*son的帖子

为什么不循环启动?

我有以下代码,一切似乎工作除了while循环,这里是代码:

JLabel img = new JLabel(loadingScreens.getImageIcon(0));
    loadingFrame.setUndecorated(true);
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    double width = screenSize.getWidth();
    double height = screenSize.getHeight();
    int wid = (int) width;
    int hgt = (int) height;
    wid = wid/2;
    hgt = hgt/2;
    wid -=350;
    hgt -=350;
    loadingFrame.setLocation(wid, hgt);

    loadingFrame.setSize(700, 700);
    loadingFrame.setBackground(new Color(0,0,0,0));
    loadingFrame.add(img);
    loadingFrame.setIconImage(loadingScreens.getImage(0));
    loadingFrame.setVisible(true);
    System.out.println("Done 1");
    try{
    Thread.sleep(500);
    System.out.println("Done 2");
    }catch(Exception e){
        System.out.println("exception caught");
    }

    Integer lo = 0;
    System.out.println("Done 3");
    while(lo.equals(256)){

        System.out.println("Started 4");

        loadingFrame.setBackground(new Color(lo, lo, lo, lo));

        loadingFrame.repaint();
        try{
            Thread.sleep(10);
        }catch(Exception e2){ …
Run Code Online (Sandbox Code Playgroud)

java loops while-loop

0
推荐指数
1
解决办法
96
查看次数

标签 统计

java ×1

loops ×1

while-loop ×1