Okay, so I've been working on a vocabulary flashcard-ish application and I came across a problem. I've been able to deal with it, but I believe that my solution may be messy and not very good design practice.
So my JFrame is called VocabApp, with a JPanel called VocabPanel, which holds all the GUI components. VocabApp has a JMenuBar, VocabMenu. VocabPanel has an instance of VocabGame, which deals with all the game logic and stuff and also holds an instance of VocabList, which deals with all the vocabulary words and their definitions.
Whew, that was a lot, I hope that made sense. Rephrased: VocabApp has a VocabMenu and a VocabPanel. VocabPanel has a VocabGame which has a VocabList.
So when I want to open a file, I open a JFileChoose from the VocabMenu. Once VocabMenu gets the File, it has to pass it all the way to VocabList, which will process the data accordingly. However, currently I'm doing something like this to solve the problem:
CODE
VocabApp top; //the top level JFrame
File f;
top.getPanel().getGame().getList().loadList(f);
Sure, it works, but I feel weird having to call top.getPanel() and panel.getList(). It just seems wrong, because the game logic stuff should just be like left alone.
So any suggestions on how to solve this weird design issue?