Předmět Autor Datum
Co myslíš tím "dotklo"? nový
Wikan 26.02.2014 21:15
Wikan
Dtklo se v JFramu nový
Meowxiik 03.03.2014 11:11
Meowxiik
Ani trochu nie je jasné, na čo sa pýtaš. nový
los 03.03.2014 23:29
los
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