View Javadoc

1   /*
2    * Copyright (C) 2010 Unreal Visualizer Authors
3    *
4    * This program is free software: you can redistribute it and/or modify
5    * it under the terms of the GNU General Public License as published by
6    * the Free Software Foundation, either version 3 of the License, or
7    * (at your option) any later version.
8    *
9    * This program is distributed in the hope that it will be useful,
10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12   * GNU General Public License for more details.
13   *
14   * You should have received a copy of the GNU General Public License
15   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16   */
17  package nl.tudelft.goal.ut2004.visualizer.gui.dialogs;
18  
19  import java.awt.FlowLayout;
20  import java.awt.Frame;
21  import javax.swing.JButton;
22  import javax.swing.JDialog;
23  import nl.tudelft.goal.ut2004.visualizer.gui.action.ChangeMapAction;
24  import nl.tudelft.goal.ut2004.visualizer.gui.widgets.MapBox;
25  import nl.tudelft.goal.ut2004.visualizer.util.WindowPersistenceHelper;
26  
27  /**
28   * Dialog for changing speed of the game.
29   * 
30   * @author M.P. Korstanje
31   * 
32   */
33  public class ChangeMapDialog extends JDialog {
34  
35  
36  	private MapBox mapSelection;
37  	private JButton changeMap;
38  	/**
39  	 * Helper class to persist this window.
40  	 */
41  	private WindowPersistenceHelper persistenceHelper;
42  	
43  	public ChangeMapDialog(Frame parent) {
44  		super(parent, false);
45  
46  		setTitle("Change Map");
47  		
48  		this.mapSelection = new MapBox();
49  		this.changeMap = new JButton("Change map");
50  		this.changeMap.addActionListener(new ChangeMapAction(mapSelection));
51  
52  		setLayout(new FlowLayout());
53  		add(mapSelection);
54  		add(changeMap);
55  		
56  		this.setSize(400, 75);
57  		// Setup persistence
58  		persistenceHelper = new WindowPersistenceHelper(this);
59  		persistenceHelper.load();
60  
61  	}
62  }