tags:

views:

70

answers:

2

I'm working on a java application which requires the creation of a tournament bracket to take in event results, and I would like to display this tournament in a JFrame if possible, it needs to show 2,4,8,16, etc original players. I want to dynamically generate this using a jcombobox to ask the user how many players they want in the event and then have the appropriate number (and hopefully appropriately spaced) of jtextboxes.

Any ideas on an "easy" way to go about coding this myself? Not looking for complete code, just a starting point.

Edit: When I get around to finishing up code for this project, I'll post the layout I've done here for everyone's future reference.

+1  A: 

This is a partial answer, but you could arrange the players names like this:

Player 1         Player 2          Player 3
Player 2
Player 3         Player 3
Player 4

If you have to have the lines, you'll have to draw the diagram on a JPanel, and have another JPanel for data entry.

Gilbert Le Blanc
That was one solution I looked at. That would be somewhat simpler to implement than a graph from both sides, but unfortunately somewhat less aesthetically pleasing. Cheers.
EricR
A: 

You could go with a JPanel that has a GridLayout with a single row. In each slot of the GridLayout, you have another JPanel. These JPanel instance are also managed by a GridLayout, but in these panels, they hold a single column of JPanels. Each of these internal JPanel instances would hold your JTextFields.

akf
Interesting idea, though managing all of those JPanels seems like an overly complex solution, just becoming bloated. Say with 32 players, you would have 1 for the main, 9 columns (16 from each side), and 32 rows, making for 42 JPanels. Nice idea though.
EricR