Revision 510
graphical updates
Colonet.java | ||
---|---|---|
419 | 419 |
if (i < num - 1) |
420 | 420 |
txtMatrix.append("\n"); |
421 | 421 |
} |
422 |
|
|
422 |
repaint(); |
|
423 | 423 |
} |
424 | 424 |
|
425 | 425 |
public void connect () { |
... | ... | |
489 | 489 |
for (int i = 0; i < num; i++) |
490 | 490 |
cmbRobotNum.addItem(new String("" + xbeeID[i])); |
491 | 491 |
cmbRobotNum.setSelectedItem(oldSelection); |
492 |
repaint(); |
|
492 | 493 |
} |
493 | 494 |
|
494 | 495 |
/** |
... | ... | |
517 | 518 |
if (selected == botNum) { |
518 | 519 |
batteryIcon.setLevel(level); |
519 | 520 |
} |
521 |
repaint(); |
|
520 | 522 |
} |
521 | 523 |
|
522 | 524 |
/** |
... | ... | |
536 | 538 |
} |
537 | 539 |
|
538 | 540 |
robotIcons = newList; |
541 |
repaint(); |
|
539 | 542 |
|
540 | 543 |
} |
541 | 544 |
|
... | ... | |
545 | 548 |
// |
546 | 549 |
public void mousePressed(MouseEvent e) { |
547 | 550 |
//Start a new Thread to handle the MouseEvent |
548 |
SwingUtilities.invokeLater(new MouseHandler(e));
|
|
551 |
(new MouseHandler(e)).start();
|
|
549 | 552 |
} |
550 | 553 |
public void mouseExited(MouseEvent e) { |
551 | 554 |
} |
... | ... | |
565 | 568 |
// |
566 | 569 |
public void keyPressed (KeyEvent e) { |
567 | 570 |
//Start a new Thread to handle the KeyEvent |
568 |
SwingUtilities.invokeLater(new KeyHandler(e));
|
|
571 |
(new KeyHandler(e)).start();
|
|
569 | 572 |
} |
570 | 573 |
public void keyReleased (KeyEvent e) { |
571 | 574 |
} |
... | ... | |
577 | 580 |
// |
578 | 581 |
public void actionPerformed (ActionEvent e) { |
579 | 582 |
// Start a new Thread to handle the ActionEvent |
580 |
SwingUtilities.invokeLater(new ActionHandler(e));
|
|
583 |
(new ActionHandler(e)).start();
|
|
581 | 584 |
} |
582 | 585 |
|
583 | 586 |
class MouseHandler extends Thread { |
... | ... | |
681 | 684 |
vectorController.setZero(); |
682 | 685 |
vectorController.sendToServer(); |
683 | 686 |
} |
687 |
repaint(); |
|
684 | 688 |
} |
685 | 689 |
} |
686 | 690 |
|
... | ... | |
785 | 789 |
} else if (source == btnUpdateTasks) { |
786 | 790 |
csi.sendQueueUpdate(); |
787 | 791 |
} |
788 |
|
|
792 |
|
|
793 |
repaint(); |
|
789 | 794 |
} |
790 | 795 |
|
791 | 796 |
} |
... | ... | |
796 | 801 |
* |
797 | 802 |
*/ |
798 | 803 |
class DataUpdater extends Thread { |
799 |
final int DATAUPDATER_DELAY = 1200;
|
|
804 |
final int DATAUPDATER_DELAY = 800;
|
|
800 | 805 |
|
801 | 806 |
public DataUpdater () { |
802 | 807 |
super("Colonet DataUpdater"); |
... | ... | |
833 | 838 |
protected Image img; |
834 | 839 |
|
835 | 840 |
public GraphicsPanel (Image img) { |
836 |
super(); |
|
837 |
this.img = img; |
|
841 |
this(img, true); |
|
838 | 842 |
} |
839 | 843 |
|
840 | 844 |
public GraphicsPanel (Image img, boolean isDoubleBuffered) { |
... | ... | |
868 | 872 |
} |
869 | 873 |
System.gc(); |
870 | 874 |
img = newimg; |
875 |
repaint(); |
|
871 | 876 |
} |
872 | 877 |
|
873 | 878 |
|
... | ... | |
931 | 936 |
} |
932 | 937 |
|
933 | 938 |
// Identify currently-selected robot |
934 |
if (selectedBot == -1)
|
|
939 |
if (selectedBot < 0)
|
|
935 | 940 |
return; |
936 |
g.setColor(Color.YELLOW);
|
|
941 |
g.setColor(Color.BLACK);
|
|
937 | 942 |
RobotIcon r = robotIcons.get(selectedBot); |
938 |
g.drawOval(r.x-RADIUS-6, r.y-RADIUS-6, 2*r.RADIUS+12, 2*r.RADIUS+12); |
|
939 |
|
|
943 |
int px = (int) (x + r.x * scale); |
|
944 |
int py = (int) (y + r.y * scale); |
|
945 |
g.drawOval(px-RADIUS-6, py-RADIUS-6, 2*r.RADIUS+12, 2*r.RADIUS+12); |
|
940 | 946 |
} |
941 | 947 |
|
942 | 948 |
} |
... | ... | |
947 | 953 |
*/ |
948 | 954 |
class WebcamLoader extends Thread |
949 | 955 |
{ |
950 |
final int WEBCAMLOADER_DELAY = 500;
|
|
956 |
final int WEBCAMLOADER_DELAY = 400;
|
|
951 | 957 |
final String IMAGE_PATH = "http://roboclub9.frc.ri.cmu.edu/colonet.jpg"; |
952 | 958 |
|
953 | 959 |
URL imagePath; |
Also available in: Unified diff