inner class button code example

Example: inner class button

import javafx.application.Application;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Line;


public class TicTacToeBoardStart extends GridPane{

    static public final int SIZE = 3;

    public TicTacToeBoardStart(){
    this.createBoard;
}

    private void createBoard(){
        ButtonHandler bHandler = new ButtonHandler();
        for (int line = 0; line < SIZE; line++){
            Button button = new Button(line + ",  " + col);
            button.setOnAction(bHandler);
            this.add(button, col, line);
            }
        }
    }

Tags:

Misc Example