/**
* Draws a black triangle-shaped shadow with the vertix in the middle of the
* Rectangle <code> from</code> and the base centred in the middle of the
* Rectangle <code>to</code>. The base width is determined by the parameter
* <code>defaultWidth</code>. the base at <code>base</code>.
*
* @param vertix
* @param base
*/
private void draw(Rectangle from, Rectangle to) {
GraphicsJLabel label = this;
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
xx[0] = from.getX() + from.getWidth() / 2;
yy[0] = from.getY() + from.getHeight() / 2;
xx[1] = to.getX() + to.getWidth() / 2;
yy[1] = to.getY() + to.getHeight() / 2;
double alpha = atan(Math.abs((xx[1] - xx[0]) / (yy[1] - yy[0])));
xx[2] = xx[1] + DEFAULT_WIDTH * cos(alpha);
yy[2] = yy[1] + DEFAULT_WIDTH * sin(alpha);
label.updateUI();
}
});
}
GraphicsJLabel.java 文件源码
java
阅读 37
收藏 0
点赞 0
评论 0
项目:Progetto-B
作者:
评论列表
文章目录