package belotetime.application.components;
import belotetime.core.controller.AbstractController;
import belotetime.core.view.StageView;
import javafx.event.ActionEvent;
import javafx.event.Event;
import javafx.event.EventHandler;
import javafx.scene.control.Button;
public class JoinButton extends Button
{
private int value;
private StageView view;
@SuppressWarnings({ "unchecked", "rawtypes" })
public JoinButton(String title, int value, StageView view)
{
super(title);
this.value = value;
this.view = view;
setOnAction(new EventHandler()
{
@Override
public void handle(Event event)
{
Object[] obj = new Object[1];
obj[0] = JoinButton.this.value;
JoinButton.this.view.getController().execute("setValue", obj);
JoinButton.this.view.getController().removeView(JoinButton.this.view);
JoinButton.this.view.getController().execute("addGamePlayer", null);
JoinButton.this.view.hide();
}
});
}
public int getValue()
{
return value;
}
}