
Untitled
By: a guest on
Aug 20th, 2012 | syntax:
Java | size: 1.03 KB | hits: 13 | expires: Never
public boolean PridejLokaciKTo( Location loc, MouseEvent e )
{
Deska PosledniStavDesky = Hr.VratPosledniDesku();
AbHrac Hrajici = Hr.KdoJeNaTahu();
List<Tah> MozneTahyASkoky = Hr.ph.getMozneTahy( PosledniStavDesky, Hrajici);
List<Location> locationsTo = new ArrayList<Location>();
Tah novyTah = new Tah( NaklikanyTah.getFrom(), locationsTo );
try
{
locationsTo = NaklikanyTah.getTo();
}
catch ( NullPointerException e1 )
{ }
locationsTo.add( loc );
novyTah.setTo( locationsTo );
if ( novyTah.isTahInList(MozneTahyASkoky) <= 1 )
{ NaklikanyTah = novyTah;
return true;
// JPanel clickedPanel = (JPanel) chessBoard.getComponentAt(e.getX(), e.getY());
// clickedPanel.setBackground(Color.yellow);
}
else
{
return false;
// System.out.println("Location to remove " + locationsTo.get(locationsTo.size() - 1));
// locationsTo.remove(locationsTo.size() - 1);
}
}