Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 20th, 2012  |  syntax: Java  |  size: 1.03 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.     public boolean PridejLokaciKTo( Location loc, MouseEvent e )
  2.     {
  3.         Deska PosledniStavDesky = Hr.VratPosledniDesku();
  4.         AbHrac Hrajici = Hr.KdoJeNaTahu();
  5.         List<Tah> MozneTahyASkoky = Hr.ph.getMozneTahy( PosledniStavDesky, Hrajici);
  6.        
  7.         List<Location> locationsTo = new ArrayList<Location>();
  8.  
  9.         Tah novyTah = new Tah( NaklikanyTah.getFrom(), locationsTo );
  10.        
  11.         try
  12.         {      
  13.                 locationsTo = NaklikanyTah.getTo();    
  14.         }
  15.         catch   ( NullPointerException e1 )
  16.         {       }
  17.                
  18.                 locationsTo.add( loc );
  19.         novyTah.setTo( locationsTo );
  20.        
  21.         if ( novyTah.isTahInList(MozneTahyASkoky) <= 1 )
  22.         {       NaklikanyTah = novyTah;        
  23.                 return true;
  24. //              JPanel clickedPanel = (JPanel) chessBoard.getComponentAt(e.getX(), e.getY());
  25. //              clickedPanel.setBackground(Color.yellow);      
  26.         }      
  27.         else
  28.         {
  29.                 return false;
  30. //              System.out.println("Location to remove " + locationsTo.get(locationsTo.size() - 1));
  31. //              locationsTo.remove(locationsTo.size() - 1);
  32.         }
  33.     }