Java Reference
In-Depth Information
Matrix {
columns: ncols
sequence: sub
};
}
An example of using a Matrix is shown in the following listing. This uses a 9u9
matrix similar to the Sudoku pattern. The getRow(3) and getColumn(5) func-
tions return a sequence of Integers, whereas the subMatrix(3,3, 5,5) function
returns a new 3u3 matrix.
var sudoku = Matrix {
columns: 9
sequence: [
1,2,3,1,2,3,1,2,3,
4,5,6,4,5,6,4,5,6,
7,8,9,7,8,9,7,8,9,
1,2,3,1,2,3,1,2,3,
4,5,6,4,5,6,4,5,6,
7,8,9,7,8,9,7,8,9,
1,2,3,1,2,3,1,2,3,
4,5,6,4,5,6,4,5,6,
7,8,9,7,8,9,7,8,9,
]
}
var row = sudoku. getRow (3);
var col = sudoku. getColumn (5);
var box = sudoku. subMatrix (3,3, 5,5);
Chapter Summary
These are just a few code recipes that may help you develop your applications in
JavaFX. There are probably many more, but we wanted to cover a few classes
that contained interesting aspects. We hope these recipes help you to better
understand some of the finer points that we have experienced while preparing
this topic.
We have covered all of the basic concepts of JavaFX including the JavaFX lan-
guage, features, and framework classes. Now it is time to put all this together in
an application. We have elected to do a Sudoku game. This application demon-
strates most of the concepts we have discussed in this topic and we feel it will
help you to see how it all comes together.
 
 
Search WWH ::




Custom Search