我有以下代码,除了循环之外,一切似乎都在工作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){
}
lo++;
}
loadingFrame
作为一个基本的JFrame。
任何帮助都是有用的