📄 tab0_2.html
字号:
<html>
<body>
<font face="Verdana" size="3"><b>API of FadeComponent as follow:</b> (NOTE: private attributes and methods are omitted)<br></font><hr>
<pre><font face="courier new" size="3">
<b>Fields:</b>
// usage explained in demo 4
protected boolean animating;
// usage explained in demo 4
protected Thread animator;
<b>Constructors:</b>
// default constructor
public FadeComponent();
// constructor with all parameters specified.
// Explanation of each parameter explained in "Bean method" part
public FadeComponent(String pattern, int loops, int steps, int precision);
<b>Bean Methods:</b> (NOTE: mainly for integration into IDE for fast development purpose.)
// elements of pattern are character 'i' or 'o' or a positive integer.
// each pattern string has at least one element. multiple elements are separated by '_'.
// 'i'/'o' means fade in/out respectively; int specifies a delay time in milliseconds.
// e.g. "i_500_o_500" means fade in first, followed by a delay of 500ms,
// then fade out, and followed by another delay of 500 ms.
// chars other than 'i' and 'o', or negative or 0 delay, or missing '_' will cause
// IllegalArgumentException be thrown from the set method.
// default value is "i", i.e. fade in
set/getPattern(String pattern);
// number of times to repeat the above pattern.
// 0 or negative value means loop forever.
// default value is 1, i.e. loop once.
set/getLoops(int loops);
// number of steps to go from 100% transparent to 0% transparent (fade in) or
// 0% transparent to 100% transparent (fade out).
// each step will change the transparent value by 100%/step percent.
// default value is 100.
set/getSteps(int steps);
// number of milliseconds between two consecutive steps.
// default value is 50 (ms)
// NOTE: total time take to complete a "fade in" or a "fade out" = step * precision (ms)
set/getPrecision(int precision);
<b>Animation Control Methods:</b>
// start animation as specified by the parameters.
// synchronized is used to make sure only one control thread is running at any time.
// if animation is already running (not yet terminated), call to this method simply returns.
public synchronized void startAnimation();
// checks whether animation is running
public boolean isAnimating();
<b>Methods that shouldn't be overriden by subclasses:</b>
// this is implementation of the "run" method of the Runnable interface.
// animation are controlled by this method.
public void run();
// overrides the paintComponent method of JComponent. alpha value is set by this method
// to realize fadeing effect.
protected void paintComponent(java.awt.Graphics g);
<b>Replacement for paintComponent method:</b>
// subclasses that want to customize their graphics should override this method.
// this is analogy to normal subclasses of JComponent overrides the paintComponent method.
// implementation of this method is empty.
protected void paintContext(java.awt.Graphics2D g);
</font></pre>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -