I am pretty new to Java but I am trying to create a map of a room using an array however I do not know how to add it to my app class. Since the code is too long I will share the view class I have been trying to work with in order to add it to my application. I removed the code adding the other components to my application because of the length but the picture attached is the output I am getting.
Any help would be GREATLY appreciated. I have exhausted every option. Thanks.
import javafx.geometry.HPos;
import javafx.geometry.Insets;
import javafx.geometry.VPos;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.RadioButton;
import javafx.scene.control.TextField;
import javafx.scene.layout.GridPane;
public class FloorBuilderView extends GridPane {
private FloorPlan model;
//component on window
private Button buildingOverview;
private Button roomTilesColor;
private FloorPlan fp;
private Button[][] buttons;
private RadioButton exit;
private RadioButton walls;
private RadioButton roomTiles;
private RadioButton selectRoom;
private TextField floorSummary;
private Label selectEdit;
private Label floorLayoutLabel;
private Label floorSummaryLabel;
public FloorBuilderView(){
// model = fp; // Store the model so that the update() method can access it
fp = FloorPlan.floor1();
fp = new FloorPlan(20, "Main Floor");
int[][] tiles = {
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
{1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,1,0,0,0,1,1,1,1,0,1,1,1,1,1},
{1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1},
{1,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,1},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}};
for (int r=0; r<20; r++)
for (int c=0; c<20; c++)
fp.setWallAt(r,c,tiles[r][c]==1);
setPadding(new Insets(10,10,10,10));
//floorPlan = new Panel(new GridLayout(fp.size(), fp.size(), 0, 0));
//buttons = new Button[fp.size()][fp.size()];
update();
}
public void update() {
}
}