How do I make the next button go to the next Frame in this GUI? I need to have it where I can click next to display 20 more details:
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
public class FilledFrameViewer
{
   public static void main(String[] args)
   {
      JFrame frame = new JFrame();
      /*JButton button = new JButton*/
      JButton nextButton = new JButton("NEXT");
      JLabel label = new JLabel("Frame 1.");
      JPanel panel = new JPanel();
      panel.add(nextButton);
      panel.add(label);
      frame.add(panel);
      final int FRAME_WIDTH = 300;
      final int FRAME_HEIGHT = 100;
      frame.setSize(FRAME_WIDTH, FRAME_HEIGHT);
      frame.setTitle("A frame with two components");
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      frame.setVisible(true);
   }
}
 
     
     
     
    