I need a little help with something... I was re-instating the random deck checkboxes (singletons, no artifacts and no small) seeing as it wasn't actually hooked up to anything anymore. While I was at it I moved them from the start button panel into the deck panel where they are added after the deck chooser when the deck is repopulated after changing to a random deck type. It's working perfectly except for one thing - when I change deck section focus jumps back to player one. I've tried tracing why it's happening but I could only get as far as knowing that player 1's avatar is gaining focus which then calls changePlayerFocus etc. How do I trace what calls are being made exactly?
If it helps, I added an IDecksComboListener to each FDeckChooser's combo box when they're first populated:
- Code: Select all
//in VSubmenuConstructed.populate():
//existing code
for (FDeckChooser fdc : deckChoosers) {
fdc.populate();
//new listener added here
fdc.getDecksComboBox().addListener(new IDecksComboBoxListener() {
@Override
public void deckTypeSelected(DecksComboBoxEvent ev) {
VSubmenuConstructed.this.populateDeckPanel(false);
}
});
}
The getDecksComboBox() is just a basic method in FDeckChooser
- Code: Select all
public DecksComboBox getDecksComboBox() {
return decksComboBox;
}
Without that listener, the current player keeps focus correctly, but I need to call populateDeckPanel in order to add in the checkboxes when required. According to console prints, the deck is populated for the correct player first, then player 1's avatar gains focus which subsequently changes player and repopulated the deck panel for player one. It doesn't make sense to me! Why is it giving focus to that avatar? I've tried println's after pretty much every requestFocusInWindow call that I could find and none of those seem to be involved. I'm just stymied.
I can't even post a patch or the code I have so far because my modem was struck by lightning while I was unplugging other things, and I won't be able to replace it until some clients pay up their overdue payments. But if someone tried to track this down the other relevant code is:
- Code: Select all
//in populateDeck after adding the deckChooser:
if (!firstBuild && deckChoosers.get(playerWithFocus).getSelectedDeckType().toString().contains("random") {
// this code just moved from pnlStart:
final String constraints = ....
decksFrame.add(cbSingletons, constraints);
...etc for cbArtifacts and cbRemoveSmall
Edit: a simple call to populateDeckPanel() produces exactly the same thing. I just didn't go this route originally because I only wanted to repopulate on deck type change, not every deck selection.
Edit 2: funny thing, it turns out DECKGEN_NOSMALL is never actually used anywhere. I'll remove it as I move the variants across.
-----
In other news I've started moving variants over to the new match setup screen. I've made the change to registered player. I still need to move across the deck section selectors applicable to each section, change methods that deal with GameType to instead work with List<GameType> And I'll probably have to change a few other things. I'll see as I go.