📄 tab2_2.html
字号:
<html>
<body>
<font face="Verdana">The same effect can be achieved as demo 1 without creating a
new label object, but customize the graphics by overriding the
<font color="#0000FF">paintContext</font> method.</font><hr>
<pre><font face="Courier New" size="3"> ...
FadeComponent fc = new FadeComponent() {
java.awt.Image image = CREATE_AN_IMAGE_HERE;
protected void paintContext(java.awt.Graphics2D g) {
g.drawImage(image, 0, 0, this);
}
}
fc.setPreferredSize(APPROPRIATE_SIZE);
fc.setPattern("i_500_o_500");
fc.setLoops(-1);
fc.setSteps(100); // = default value, can be omitted
fc.setPrecision(50); // = default value, can be omitted
...
// add fc to container,
// and call 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 + -