How to load a new screen on a JFrame
posted 8 years ago
I'm new to Swing/AWT, and I've been fooling around with it lately. I know that you can use repaint() to refresh a JFrame, but that will only re-perform the code that applies to the JFrame, but I want to have a button on the two buttons on the left. When you click the first button, there will be a text field that has something where a user can enter variable(s). When you click the other button, it would take away those text boxes and replace them with something else, say a JTextField or JLabel that would display the variable(s) entered in the previous screen and display them, or display a variable holding the something done to the other variable(s). Basically, I want to be able to "switch" screens by clicking buttons. I know how to put in an ActionListener, etc., but I don't know how to put different widgets on the screen. I also want to know if there is a better way to put things on the screen besides NORTH, SOUTH, WEST, EAST, and CENTER, or if there are ways to put, say, two widgets in the center.