1 /*
2  * $Id: TeamEditor.java,v 1.1 2003/08/24 18:37:36 juhal Exp $
3  */
4 package org.xpilot.jxpmap;
5 
6 import javax.swing.JComboBox;
7 import javax.swing.JLabel;
8 
9 /**
10  * @author jli
11  */
12 public class TeamEditor extends EditorPanel {
13 
14     private JComboBox cmbTeam;
15     private MapCanvas canvas;
16     private MapObject object;
17 
TeamEditor(String title, MapCanvas canvas, MapObject object)18     public TeamEditor(String title, MapCanvas canvas, MapObject object) {
19         setTitle(title);
20         cmbTeam = new JComboBox();
21         for (int i = -1; i <= 10; i++)
22             cmbTeam.addItem(new Integer(i));
23         cmbTeam.setSelectedIndex(object.getTeam() + 1);
24         add(new JLabel("Team:"));
25         add(cmbTeam);
26         this.canvas = canvas;
27         this.object = object;
28     }
29 
apply()30     public boolean apply() {
31         int newTeam = cmbTeam.getSelectedIndex() - 1;
32         if (newTeam != object.getTeam())
33             canvas.setObjectTeam(object, newTeam);
34         return true;
35     }
36 }
37