Hi there. I'm busy working on a GUI project. For the project, I have to make a very basic gui system that a business would use to do a few tasks.

Essentially I have a start-up screen that asks what the user would like to do. 3 buttons are present - make a transaction, check stock levels and check debtors. If I click on one of the buttons it takes you to the screen of the option that you chose.

Now this is working fine for my second option, but having done the exact same thing for the first, it doesn't open the relevant screen. Button action code is:

The second private void isn't opening the relevant screen, whereas the first one is. For the second one, it is completing the first command (setvisible(false);) but not initiating the new screen.

You're creating a makeATransaction object, mt, but I don't see where you're adding it to any part of your GUI. Assuming that this is a Swing application, in order to show a component, it must be added to a container that is part of the hierarchy that ultimately leads to a top-level window such as a JFrame, JApplet, JDialog, etc..., and you're not doing that. Also, if you swap components in and out like this, you have to be sure that the container's layout manager will like you're doing this. Also you'd need to call revalidate() and repaint() on the container.

If this were my project, I'd try to save a lot of time and trouble by using a CardLayout to allow me to swap views. There's a good tutorial on this that Google will help you find. I recommend that you have a look at it.

Other suggestions: don't use quote tags when posting code or it will look like this:

Also, consider giving your question a more helpful title. "A few GUI questions" is a very broad title and doesn't succinctly summarize what the problems specifically are. Better would be something like, "Problem getting swapped Swing components to show." or something like that. These suggestions are all contained in the links that Darryl gave you.