まず第一に、私はJavaの初心者です。JavaFX を使用して Java でモノポリー ゲームを作成しようとしています。グリッドペインでボードを描きました。
public class BordView extends GridPane {
public BordView() {
RowConstraints rowsEdge = new RowConstraints();
rowsEdge.setPercentHeight(14);
RowConstraints rowsMid = new RowConstraints();
rowsMid.setPercentHeight(8);
ColumnConstraints colEdge = new ColumnConstraints();
colEdge.setPercentWidth(14);
ColumnConstraints colMid = new ColumnConstraints();
colMid.setPercentWidth(8);
this.getColumnConstraints().addAll(colEdge, colMid,
colMid, colMid, colMid, colMid, colMid, colMid, colMid, colMid, colEdge);
this.getRowConstraints().addAll(rowsEdge, rowsMid,
rowsMid, rowsMid, rowsMid, rowsMid, rowsMid, rowsMid, rowsMid, rowsMid, rowsEdge);
this.setGridLinesVisible(true);
}
ここで私の質問: これらのセルに名前、金額、色を付けるにはどうすればよいですか? セルの座標または何かを取得する方法はありますか。もしそうなら、私はそれらをループで埋めることができます。
前もって感謝します、 ネイサン