Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Actually I don't think you need textfields in the grid squares but just to write down every single letter for every grid cell..</p> <p>To allow editing you just catch keyboard strokes over the component you use and set crossword cells according to what the user writes.</p> <p>Doing it this way would be quite easy because you can use a back 2-dimensional array that stores the whole grid, then when the user select a definition you just start filling single letters whenever keys are typed starting from the first cell of the definition.. your draw routine will need just to be able to draw the grid and center letters inside cells, nothing more..</p> <p>A <code>JTable</code> could work but it think it's oversized for your problem, because you'll end up interfacing with a lot of things you don't need at all..</p> <p><em>EDIT (for comment)</em>:</p> <p>I did it something similar this way: you can have a cell class</p> <pre><code>class Cell { boolean isBlank; char value; } </code></pre> <p>with an array of cells you obtain your grid:</p> <pre><code>Cell[][] gamefield = new Cell[15][15]; </code></pre> <p>then inside <code>paint()</code> you can easily iterate:</p> <pre><code>for (int i = 0; i &lt; Scheme.rows; ++i) { for (int j = 0; j &lt; Scheme.cols; ++j) { g2.drawRect(i*32, j*32, 32, 32); if (Scheme.scheme[i][j].isBlank) g2.fillRect(i*32 + 3, j*32 + 3, 32 - 5, 32 - 5); } } </code></pre> <p>Just because I still have a screenshot result was something like <a href="http://img3.imageshack.us/img3/7374/68514939.png" rel="nofollow noreferrer">alt text http://img3.imageshack.us/img3/7374/68514939.png</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload