abel.setText(""); try { M = Integer.parseInt(mTextField.getText()); N = Integer.parseInt(nTextField.getText()); } catch(NumberFormatException ex) { output.setText("No numbers."); return; } if(M <= 0 || M > 20 || N <= 0 || N > 30) { output.setText("Illegal values."); return; } output.setText(""); panel.hide(); panel.removeAll(); panel.setLayout(new GridLayout(M, N)); panel.reshape(12, 140, N * 14, M * 14); Checkbox c = new Checkbox(); c.disable(); panel.add(c); for(int i = 1; i < M * N - 1; i++) panel.add(new Checkbox()); c = new Checkbox(); c.disable(); panel.add(c); panel.validate(); panel.show(); array = new byte[M][N]; solveButton.show(); buttonLabel.setText("(4) Push this button to solve this maze"); } public void init() { super.init(); addNotify(); //{{INIT_CONTROLS setLayout(null); resize(482,515); setBackground(new Color(12632256)); titleLabel = new java.awt.Label("Find shortest path in Maze"); titleLabel.reshape(12,0,339,25); titleLabel.setFont(new Font("Dialog", Font.BOLD, 16)); add(titleLabel); //}} mTextField = new TextField(); mTextField.reshape(12, 32, 99, 27); add(mTextField); nTextField = new TextField(); nTextField.reshape(12, 68, 99, 25); add(nTextField); inputMazeButton = new Button("Edit new maze"); inputMazeButton.reshape(12, 104, 98, 25); add(inputMazeButton); label1 = new Label("(1) Fill in the number of rows (1-20)"); label1.reshape(120, 32, 204, 24); add(label1); label2 = new Label("(2) Fill in the number of columns (1-30)"); label2.reshape(120, 68, 205, 26); add(label2); label3 = new Label("(3) Push this button to edit the maze"); label3.reshape(120, 104, 336, 26); add(label3); panel = new Panel(); panel.setLayout(null); panel.reshape(12, 152, 120, 108); add(panel); solveButton = new Button("Solve!"); solveButton.hide(); solveButton.reshape(12, 440, 120, 26); add(solveButton); output = new TextField(); output.setEditable(false); output.reshape(12, 476, 420, 22); add(output); editButton = new Button("Edit current maze"); editButton.hide(); editButton.reshape(12, 440, 120, 24); add(editButton); buttonLabel = new Label(""); buttonLabel.reshape(144, 440, 332, 22); add(buttonLabel); } public boolean handleEvent(Event event) { if(event.target == inputMazeButton && event.id == 1001) { inputMazeButton_Clicked(event); return true; } if(event.target == solveButton && event.id == 1001) { solveButton_Clicked(event); return true; } if(event.target == editButton && event.id == 1001) { editButton_Clicked(event); return true; } else { return super.handleEvent(event); } } public InputMaze() { } int M; int N; byte array[][]; Maze maze; TextField mTextField; TextField nTextField; Button inputMazeButton; Label label1; Label label2; Label label3; Panel panel; Button solveButton; TextField output; Button editButton; Label buttonLabel; //{{DECLARE_CONTROLS java.awt.Label titleLabel; //}} }