1 package nl.tudelft.goal.ut2004.visualizer.gui.panels;
2
3 import java.awt.FlowLayout;
4 import java.util.Collection;
5
6 import javax.swing.BorderFactory;
7 import javax.swing.JButton;
8 import javax.swing.JLabel;
9 import javax.swing.JPanel;
10 import javax.swing.JSpinner;
11 import javax.swing.SpinnerNumberModel;
12 import javax.swing.border.TitledBorder;
13
14 import nl.tudelft.goal.ut2004.visualizer.controller.ServerController;
15 import nl.tudelft.goal.ut2004.visualizer.gui.action.ChangeMapAction;
16 import nl.tudelft.goal.ut2004.visualizer.gui.action.PauseResumeAction;
17 import nl.tudelft.goal.ut2004.visualizer.gui.action.SetSpeedAction;
18 import nl.tudelft.goal.ut2004.visualizer.gui.widgets.MapBox;
19 import nl.tudelft.goal.ut2004.visualizer.gui.widgets.SuggestionField;
20 import nl.tudelft.goal.ut2004.visualizer.gui.widgets.SuggestionModel;
21 import nl.tudelft.goal.ut2004.visualizer.util.SelectableMapList;
22
23 import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.MapList;
24 import cz.cuni.amis.pogamut.ut2004.server.IUT2004Server;
25
26 public class ServerPanel extends JPanel {
27
28 private final JButton pause;
29 private final JSpinner speedSelection;
30 private final JLabel setSpeed;
31 private final MapBox mapSelection;
32 private final JButton changeMap;
33
34 public ServerPanel() {
35
36
37 this.pause = new JButton(new PauseResumeAction());
38 this.speedSelection = new JSpinner(
39
40 new SpinnerNumberModel(1, 0.1, 5.0, 0.1));
41 this.speedSelection
42 .setEditor(new JSpinner.NumberEditor(speedSelection));
43 this.setSpeed = new JLabel("GameSpeed");
44
45 this.mapSelection = new MapBox();
46 this.changeMap = new JButton("Change map");
47 this.changeMap.addActionListener(new ChangeMapAction(mapSelection));
48
49
50 speedSelection.addChangeListener(new SetSpeedAction(speedSelection));
51
52
53
54 setLayout(new FlowLayout(FlowLayout.LEFT));
55 add(pause);
56 add(setSpeed);
57 add(speedSelection);
58 add(mapSelection);
59 add(changeMap);
60
61
62 TitledBorder title = BorderFactory
63 .createTitledBorder("Server Controls");
64 setBorder(title);
65
66 }
67 }