Beispiel #1
0
 public void actionPerformed(ActionEvent e) {
   for (int i = 0; i < colors.length; i++) {
     if (e.getSource().equals(innerMI[i])) {
       demo.innerC = colors[i];
       imenu.setIcon(squares[i]);
       break;
     } else if (e.getSource().equals(outerMI[i])) {
       demo.outerC = colors[i];
       omenu.setIcon(squares[i]);
       break;
     }
   }
   demo.repaint();
 }
Beispiel #2
0
 public void run() {
   // goto double buffering
   if (demo.getImageType() <= 1) {
     demo.setImageType(2);
   }
   Thread me = Thread.currentThread();
   while (thread == me) {
     for (int i = 0; i < innerMI.length; i++) {
       if (i != 4) {
         try {
           thread.sleep(4444);
         } catch (InterruptedException e) {
           return;
         }
         innerMI[i].doClick();
       }
     }
   }
   thread = null;
 }