Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class HighlightListener extends MouseAdapter{
- private Cell[] highlighted = new Cell[c.getSize()];
- public void mouseClicked(MouseEvent e){
- Cell cell = new Cell();
- cell = (Cell) e.getSource();
- if(cell.getAcross() != null && !cell.isHighlight()){
- if(highlighted[0] != null){
- for(Cell c : highlighted){
- c.setHighlight(false);
- }
- }
- Clue clue = cell.getAcross();
- highlighted = clue.getCellsInRange().clone();
- for(Cell c : highlighted){
- c.setHighlight(true);
- }
- } else {
- if(cell.getDown() != null){
- if(highlighted[0] != null){
- for(Cell c : highlighted){
- c.setHighlight(false);
- }
- }
- Clue clue = cell.getDown();
- highlighted = clue.getCellsInRange().clone();
- for(Cell c : highlighted){
- c.setHighlight(true);
- }
- }
- }
- repaint();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment