Revision 38
Updating Colonet GUI to new style, plus minor fixes
Colonet.java | ||
---|---|---|
432 | 432 |
} |
433 | 433 |
|
434 | 434 |
if (valid) { |
435 |
this.showStatus("Matrix OK");
|
|
435 |
this.showStatus("Running");
|
|
436 | 436 |
|
437 | 437 |
// draw robots and find which one is seleced |
438 | 438 |
double angle = 2.0 * Math.PI / numBots; |
... | ... | |
463 | 463 |
if (!entries[row][col].equals("-") && entries[col][row].equals("-") && row != col) { |
464 | 464 |
//TODO: Make a standard gray |
465 | 465 |
drawConnection(row, col, BIGRADIUS-RADIUS, new Color(200,200,200)); |
466 |
} |
|
467 |
else if (!entries[row][col].equals("-") && ! entries[col][row].equals("-") && row != col) { |
|
466 |
} else if (!entries[row][col].equals("-") && ! entries[col][row].equals("-") && row != col) { |
|
468 | 467 |
drawConnection(row, col, BIGRADIUS-RADIUS, Color.BLACK); |
469 | 468 |
} |
470 | 469 |
} |
... | ... | |
472 | 471 |
|
473 | 472 |
// draw the selection indicator |
474 | 473 |
indicator.draw(); |
475 |
txtInfo.setText("Packet statistics: ???"); |
|
476 | 474 |
|
477 | 475 |
} else {// if matrix is not valid |
478 | 476 |
this.showStatus("Error: Invalid matrix"); |
... | ... | |
604 | 602 |
|
605 | 603 |
//recalculate radius, if it will look cool, lolz |
606 | 604 |
int newr = r; |
607 |
if (steps < 100) newr = (int)( r + 200/(steps+1) ); |
|
605 |
if (steps < 100) |
|
606 |
newr = (int)( r + 200/(steps+1) ); |
|
608 | 607 |
|
609 | 608 |
//precompute values for dx and dy |
610 | 609 |
int dx_inner = (int)(newr * Math.cos(theta)); |
... | ... | |
750 | 749 |
* |
751 | 750 |
*/ |
752 | 751 |
class DataListener extends Thread { |
753 |
final int DATALISTENER_DELAY = 1000;
|
|
752 |
final int DATALISTENER_DELAY = 666;
|
|
754 | 753 |
BufferedReader reader; |
755 | 754 |
|
756 | 755 |
public DataListener () { |
... | ... | |
759 | 758 |
|
760 | 759 |
public void run () { |
761 | 760 |
String line; |
762 |
reader = csi.getBufferedReader(); |
|
763 | 761 |
while (true) { |
764 | 762 |
try { |
765 |
if (csi.isReady()) { |
|
766 |
line = reader.readLine(); |
|
767 |
if (line != null) { |
|
768 |
csi.msg("Incoming data: [" + line + "]"); |
|
769 |
//TODO: parse incoming data here |
|
770 |
} |
|
771 |
} |
|
763 |
if (csi == null) return; |
|
764 |
line = csi.getLine(); |
|
765 |
if (line != null) { |
|
766 |
csi.msg("Incoming data: [" + line + "]"); |
|
767 |
//TODO: parse incoming data here |
|
768 |
} |
|
772 | 769 |
Thread.sleep(DATALISTENER_DELAY); |
773 | 770 |
} catch (InterruptedException e) { |
774 | 771 |
return; |
Also available in: Unified diff