예제 #1
0
파일: Ex94a.java 프로젝트: citrit/ECSE4750
 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);
 }
예제 #2
0
파일: MriIso.java 프로젝트: citrit/ECSE4750
 /** 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);
 }
예제 #3
0
파일: Ex63a.java 프로젝트: citrit/ECSE4750
 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);
 }