Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Game Lobby  RSS feed

 
Bob Blumkin
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I'm trying to create a game lobby similar to those you see at yahoo or other game sites. It would be a collection of tables with each table containing among other things, the name of the game and a button to sit, if seats are available, for each available seat(different games may have a different number of total seats). I first tried using a JTable with custom renderer and editor for seats column that returned a JPanel containing the buttons. Besides seeming very inefficient with the number of times the editing/rendering methods got needlessly called, it didn't work very well. All but the first enabled buttons(buttons are not enabled if someones sitting in that seat) required an addition click for their action method to perform, the first click being to obtain the cells focus. I cannot fathom why the first enabled button does not require an initial focus click like the others do. I understand that a JList would be an even poorer solution as it does not support an editor and I would have to use some weird 'hack' to make my buttons respond when clicked. Finally, I thought of just using a JPanel, but it doesnt seem to really be possible to move or add new tables to a specific Y coordinate. It looks like GridBagLayout would be my best layout choice for attempting this, and once a component is added with a GridBagConstraint, it seems to be stuck with that GridBagConstraint, I don't see anyway of changing the 'gridY' afterwards. And if I were to set the 'gridY' equal to a preexisting 'gridY' they would overlay, right? And I think, though I could very easily be wrong, that removing all the elements from JPanel and then adding them again in desired order every time a new table is added, or someone sits or stands from a current table, would be even less efficient than with the JTable. I would greatly appreciate any input anyone can give me on this. I've been looking through forums for the last several hours trying to find a solution or read an implementation that others use, but couldn't find anything, although I'm sure it must be out there, so I apologize if this has already been discussed and I just somehow missed it. I also hope I posted this in the correct place, I'm new to this forum. Thank you.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!