I have studied some examples, but believe me or not, I have no teacher. Never had any teacher.
You mentioned a professor earlier, and someone/something is requiring you to use OpenJDK. If you and your professor aren't connecting, then all the more reason to STUDY.
They each work , but the problem is that I have 2 dialogs, each with one button.
That's not a problem.
Post runnable code IN THIS THREAD that creates 2 dialogs, each with its own button, describe what is supposed to be happening (comments in your code would be helpful), what is happening instead, and specific questions that will help you make progress.