| 447 | } |
| 448 | |
| 449 | public void paint(Graphics g) { |
| 450 | if (updateLut) { |
| 451 | updateLut(); |
| 452 | updateLut = false; |
| 453 | } |
| 454 | int index = 0; |
| 455 | for (int y=0; y<rows; y++) { |
| 456 | for (int x=0; x<columns; x++) { |
| 457 | if(index>=mapSize) { |
| 458 | g.setColor(Color.lightGray); |
| 459 | g.fillRect(x*entryWidth, y*entryHeight, entryWidth, entryHeight); |
| 460 | } else if (((index <= finalC) && (index >= initialC)) || ((index >= finalC) && (index <= initialC))){ |
| 461 | g.setColor(c[index].brighter()); |
| 462 | g.fillRect(x*entryWidth, y*entryHeight, entryWidth, entryHeight); |
| 463 | g.setColor(Color.white); |
| 464 | g.drawRect((x*entryWidth), (y*entryHeight), entryWidth, entryHeight); |
| 465 | g.setColor(Color.black); |
| 466 | g.drawLine((x*entryWidth)+entryWidth-1, (y*entryHeight), (x*entryWidth)+entryWidth-1, (y*entryWidth)+entryHeight); |
| 467 | g.drawLine((x*entryWidth), (y*entryHeight)+entryHeight-1, (x*entryWidth)+entryWidth-1, (y*entryHeight)+entryHeight-1); |
| 468 | g.setColor(Color.white); |
| 469 | } else { |
| 470 | g.setColor(c[index]); |
| 471 | g.fillRect(x*entryWidth, y*entryHeight, entryWidth, entryHeight); |
| 472 | g.setColor(Color.white); |
| 473 | g.drawRect((x*entryWidth), (y*entryHeight), entryWidth-1, entryHeight-1); |
| 474 | g.setColor(Color.black); |
| 475 | g.drawLine((x*entryWidth), (y*entryHeight), (x*entryWidth)+entryWidth-1, (y*entryWidth)); |
| 476 | g.drawLine((x*entryWidth), (y*entryHeight), (x*entryWidth), (y*entryHeight)+entryHeight-1); |
| 477 | } |
| 478 | index++; |
| 479 | } |
| 480 | } |
| 481 | } |
| 482 | |
| 483 | int getMapSize() { |
| 484 | return mapSize; |