/* -----------------------------------------------------------------------
 * The "Hello World" applet.  This is a very simple applet that puts up
 * a button, which when pressed destroys itself (since we can't really exit
 * an applet per se).
 * -----------------------------------------------------------------------
 */

package sub_arctic.test;

/* import various pieces of the sub_arctic toolkit that we need */
import sub_arctic.lib.*;
import sub_arctic.input.*;
import sub_arctic.constraints.std_cnstr;

/* We use a new subclass of interactor_applet (which is an applet capable of 
 * hosting a sub_arctic interface).
 */
public class hello_world_debug extends debug_interactor_applet 
  implements callback_object {

  /* initialization of sub_arctic interface when applet starts */
  public void build_ui(base_parent_interactor top) 
    {
      /* create a button centered in the top level interactor */
      button goodbye = new button("Goodbye", this);
      goodbye.set_x_constraint(std_cnstr.centered(PARENT.W(), 0));
      goodbye.set_y_constraint(std_cnstr.centered(PARENT.H(), 0));

      /* make the button a child of the top level */
      top.add_child(goodbye);

    }

  /* handle callback from the button. */
  public void callback(interactor from, event evt, int cb_num, Object cb_parm)
    {
      /* remove the button from the interface (since we can't exit) */
      if (from.parent() != null)
        from.parent().remove_child(from);
    }
};