Esempio n. 1
0
 public boolean action(Event evt, Object what) {
   if (evt.target instanceof MenuItem) {
     if (((String) evt.arg).equals("Exit")) {
       System.exit(1);
     }
   }
   return super.action(evt, what);
 }
Esempio n. 2
0
 /** Let capture menu events (and all others...) */
 public boolean action(Event evt, Object what) {
   if (evt.target instanceof MenuItem) {
     // Since we didn't save references to each of the menu objects,
     // we check which one was pressed by comparing labels.
     if (((String) evt.arg).equals("Animate")) {
       for (float i = 10; i < 1000; i += 200) {
         System.out.println("Contour value: " + i);
         cFilt.SetValue(0, i);
         vPanel.GetRenderWindow().Render();
         if (savetofile) {
           vPanel.GetRenderWindow().SetFileName("image." + (int) i + ".ppm");
           vPanel.GetRenderWindow().SaveImageAsPPM();
         }
       }
     }
     if (((String) evt.arg).equals("Exit")) {
       System.exit(1);
     }
   }
   System.out.println("Event: " + evt + " Object: " + what);
   return super.action(evt, what);
 }
Esempio n. 3
0
 public boolean action(Event event, Object object) {
   if (event.target instanceof MenuItem && ((String) event.arg).equals("Exit")) System.exit(1);
   System.out.println(event + " Object: " + object);
   return super.action(event, object);
 }