I can't seem to figure this one out. It seems like it would be easy...

I want the savePane JFrame to close when the user hits the saveButton.

Is there a line that I enter here? Or is there something I need to include in my saveListener class?

Any help would be great.

Thanks

private class saveWindowListener implements ActionListener
	{
		public void actionPerformed (ActionEvent e)
		{
			

		out.println ("test");
		JFrame savePane=new JFrame("Save Menu");
		savePane.setSize(300,200);
		savePane.setLocation (450, 400);
		Container pane = savePane.getContentPane();
		pane.setLayout(new GridLayout( 4, 1, 1, 1));
 

		savePane.setVisible(true);
					
		outputField = new JTextField("Enter Save Name here");
		savePane.add (outputField);
					
		saveButton = new JButton ("Save");
		savePane.add (saveButton);
					
		savePane.add( new JLabel( "Adjust Default Save path below " ) );
		savePathField = new JTextField("C:\\temp\\");
		savePane.add (savePathField);
			
		saveListener listenerSave = new saveListener ( );
		saveButton.addActionListener( listenerSave );
			
			
	}
		
}

try :

savePane.setVisible(false);

Although that will not close the frame, it will hide it! hope this helps!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.