Question
Unable to run the setTest method import javafx.application.Application; import javafx.stage.Stage; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.layout.GridPane; import javafx.scene.layout.BorderPane; import javafx.concurrent.Task; import javafx.event.EventHandler; import
Unable to run the setTest method
import javafx.application.Application; import javafx.stage.Stage; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.layout.GridPane; import javafx.scene.layout.BorderPane; import javafx.concurrent.Task; import javafx.event.EventHandler; import javafx.event.ActionEvent;
public class TootAndOtto extends Application implements EventHandler
@Override public void start(Stage primaryStage) { theObject = this; GridPane gridPane = new GridPane(); Button[][] button = new Button[row][col]; for(col = 0; col } public void handle(ActionEvent e) { Button b = (Button)e.getSource(); int c = findCol(b); int r = findRow(b); setText(b); System.out.println(c); System.out.println(r); } public int findCol(Button b) { int c = GridPane.getRowIndex(b); return c; } public int findRow(Button b) { int r = GridPane.getColumnIndex(b); return r; } public void setText(Button b) { int c = GridPane.getRowIndex(b); int r = GridPane.getColumnIndex(b); button[r][c].setText("x"); } public static void main(String[] args) { Application.launch(args); } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started