英文:
How can you update transition animation(fade in, fade out) from jframe to another jframe?
问题
我尝试过,但似乎过渡效果不够平滑,点击某些按钮后,按钮没有打开或执行淡入/淡出的动画过渡。以下是我的代码:
for (double i = 1.0; i >= 0.0; i = i - 0.1) {
String val = i + "";
float f = Float.valueOf(val);
this.setOpacity(f);
try {
Thread.sleep(30);
} catch (Exception e) {
}
StockItems a = new StockItems();
a.setVisible(true);
a.setLocationRelativeTo(null);
dispose();
}
英文:
I tried doing it but it seems like the transition is not fading in smoothly and some of the buttons after I clicked it is not opening or doing the animation transition of fade in/out. Here's my code:
for (double i = 1.0; i >=0.0; i=i-0.1){
String val=i+"";
float f = Float.valueOf(val);
this.setOpacity(f);
try{
Thread.sleep(30);
}catch(Exception e){
}
StockItems a = new StockItems();
a.setVisible(true);
a.setLocationRelativeTo(null);
dispose();
}
专注分享java语言的经验与见解,让所有开发者获益!
评论