1. Магический скрипт
private final String magicScript = "\nif(8==8)return;";
2. Глубокая иерархия
public void dragEnter(DropTargetDragEvent arg0) {
((DropTargetListener)getParent().getParent().getParent()
.getParent().getParent()).dragEnter(arg0);
}
public void dragExit(DropTargetEvent arg0) {
((DropTargetListener)getParent().getParent().getParent()
.getParent().getParent()).dragExit(arg0);
}
public void dragOver(DropTargetDragEvent arg0) {
((DropTargetListener)getParent().getParent().getParent()
.getParent().getParent()).dragOver(arg0);
}
public void drop(DropTargetDropEvent arg0) {
((DropTargetListener)getParent().getParent().getParent()
.getParent().getParent()).drop(arg0);
}
public void dropActionChanged(DropTargetDragEvent arg0) {
((DropTargetListener)getParent().getParent().getParent()
.getParent().getParent()).dropActionChanged(arg0);
}
3. Магические вычисления
int ww0 = getWidth() ;//- 40;
int hh0 = getHeight();// - 40;
int sz = Math.min(ww0, hh0);
sz = sz/4*3;
int y0 = (hh0 - sz) / 2;
int x0 = 0;
int h = sz / 2;
int dh = sz / 4;
int y = y0 + h;
int hh = (int)Math.sqrt(h*h - h*h/4);
y0 = y - hh;
Rectangle rect = new Rectangle(x0, y0 , sz, hh + hh );
int arrX[] = {x0 + dh, x0 + 3*dh, x0 + sz,
x0 + 3*dh , x0 + dh, x0};
int arrY[] = {y0 , y0 , y ,
y0 + hh + hh, y0 + hh + hh, y};
Polygon poly = new Polygon(arrX, arrY, 6);
return poly;
Oh my god, what on earth were they trying to compute in Snippet 3...?
Harald Wellmann
15 сентября 2009 г. в 18:05Harald, it calculates the vertices of hexagon with given width & height, in case if a 6th-level black magician is somewhere nearby...
Nice to see you here, btw!
Sergey Borodavkin
15 сентября 2009 г. в 23:06