Example #1
0
 public void setfocus(Widget w) {
   if (focusctl) {
     if (w != focused) {
       Widget last = focused;
       focused = w;
       if (hasfocus) {
         if (last != null) last.hasfocus = false;
         w.hasfocus = true;
         if (last != null) last.lostfocus();
         w.gotfocus();
       } else if ((last != null) && last.hasfocus) {
         /* Bug, but ah well. */
         last.hasfocus = false;
         last.lostfocus();
       }
       if ((ui != null) && ui.rwidgets.containsKey(w) && ui.rwidgets.containsKey(this))
         wdgmsg("focus", ui.rwidgets.get(w));
     }
     if ((parent != null) && visible && canfocus) parent.setfocus(this);
   } else {
     parent.setfocus(w);
   }
 }
Example #2
0
 public void lostfocus() {
   if (focusctl && (focused != null)) {
     focused.hasfocus = false;
     focused.lostfocus();
   }
 }