📄 tab3_2.html
字号:
<html>
<body>
<font face="Verdana">Two <font color="#0000FF">FadeComponent</font>s, of the same size, overlap each other,
but animate in the opposite style to create an effect common seen in videos.
(However, do note that since the two controlling threads are not started exactly
at the same time, due to the sequential nature of the program, the effect is not
"perfect").</font>
<hr>
<pre><font face="Courier New" size="3"> ...
FadeComponent pudongFC = new FadeComponent() {
java.awt.Image image = CREATE_PUDONG_IMAGE;
protected void paintContext(java.awt.Graphics2D g) {
g.drawImage(image, 0, 0, this);
}
}
FadeComponent eiffelFC = new FadeComponent() {
java.awt.Image image = CREATE_EIFFEL_IMAGE;
protected void paintContext(java.awt.Graphics2D g) {
g.drawImage(image, 0, 0, this);
}
}
pudongFC.setPattern("io");
eiffelFC.setPattern("oi");
pudongFC.setLoops(-1);
eiffelFC.setLoops(-1);
// omit setting of the default paramaters
int x = .., y = .., width = .., height = ..;
pudongFC.setBounds(x, y, width, height);
eiffelFC.setBounds(x, y, width, height);
container.add(pudongFC); //container doesn't use any LayoutManager
container.add(eiffelFC); //container doesn't use any LayoutManager
...
// call pudongFC.startAnimation() and eiffelFC.startAnimation when main frame first opened</font></pre>
<hr>
<p><font face="Verdana" size="3">The above method uses inner class, which is handy if
only one instance of the object is needed. If multiple instances are needed, it
is good to define a class that subclasses <font color="#0000FF">FadeComponent</font>
explicitly.</font></p>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -