Jsou zobrazeny jen nové odpovědi. Zobrazit všechny
Předmět Autor Datum
Jestli to chapu spravne, chces zjistit, jestli se dve Swing komponenty nekde dotykaji. Pak ale A i G… poslední
MaSo 04.03.2014 09:13
MaSo

Jestli to chapu spravne, chces zjistit, jestli se dve Swing komponenty nekde dotykaji. Pak ale A i G musi dedit z Component.

public boolean intersects(Component testa, Component testb){
    Rectangle rectB = testb.getBounds();
    Rectangle result = SwingUtilities.computeIntersection(testa.getX(), testa.getY(), 
                                                          testa.getWidth(), testa.getHeight(), rectB);
    return (result.getWidth() > 0 && result.getHeight() > 0);
}

Zpět do poradny Odpovědět na původní otázku Nahoru