Hello, I am working on a project using Swing/AWT, but the app has a complicated logic. The source is huge but I`ll describe in short:
I have QQuestion which extends JPanel, and has JTextArea, and 2 JButtons ( 1 for forward and 1 for backwad )
I have a QADList class which does not extends anything but containst an array of QQuestion(s) and manipulates another class MainApp which extends JFrame.
So... the task is a quiz based app. The idea is that you can`t use the back buttons more than 1 time. The second time you press a back button, a new QErrorFrame class will be fired ( gaining focus and forces you to press the error frame button which updates you to next question ).
What I did:
In QADList I follow a simple logic for removing from the list question[index] and adding question[index++] or index-- , it works so I`ll spare the details. Then I revalidate() and repaint(), but NEVER null the QQuestion classes. So if I have 20 QADLists then there will be 80 QQuestions. My QErrorFrame works as expected. So here is the problem:
The client needs a timer error message :( When I waint 2 min - the error message will be displayed ( similar to QErrorMessage ) with button and update foward porperties. I`ve tried with Timer class some code but I still gain ugly bugs like splitting the frame in 2, does not update, etc. Requirement is that only one error frame is present, be that from button click or from timer. The problem is that they collide the ugly way. I`ve removed the collision by adding additional boolean variables and set a common logic. Somehow my logic fails me or the GUI is unstable for such operation. Any good suggestion or idea how to make the countdown warning and the button click error? They can`t be both on screen. Sorry that I can`t show you code since the whole source must be pasted to make some logic ( only QADList class is 300+ lines ). Hope to give me a good advice.