Skip to content

Commit

Permalink
Switch to using Java 7, and clean up the compiler warnings around
Browse files Browse the repository at this point in the history
JComboBox that result from the switch.
  • Loading branch information
samschreiber committed Oct 24, 2013
1 parent fd36895 commit b5eb509
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 28 deletions.
7 changes: 3 additions & 4 deletions .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
#Tue Apr 13 23:54:04 PDT 2010
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6
org.eclipse.jdt.core.compiler.source=1.7
8 changes: 4 additions & 4 deletions src/org/ggp/base/apps/kiosk/Kiosk.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,14 @@ public void run() {
private final JTextField startClockTextField;

private final JButton runButton;
private final JList selectedGame;
private final JList<AvailableGame> selectedGame;
private final JCheckBox flipRoles;

private final PublishButton publishButton;

private final JPanel theGUIPanel;

private final JComboBox playerComboBox;
private final JComboBox<String> playerComboBox;
private List<Class<?>> gamers = null;
private final JTextField computerAddress;

Expand All @@ -118,13 +118,13 @@ public Kiosk()

flipRoles = new JCheckBox("Flip roles?");

selectedGame = new JList(theAvailableGames.toArray());
selectedGame = new JList<AvailableGame>(theAvailableGames.toArray(new AvailableGame[0]));
selectedGame.setSelectedIndex(0);
selectedGame.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
JScrollPane selectedGamePane = new JScrollPane(selectedGame);

computerAddress = new JTextField("player.ggp.org:80");
playerComboBox = new JComboBox();
playerComboBox = new JComboBox<String>();
playerComboBox.addItemListener(this);

gamers = ProjectSearcher.getAllClassesThatAre(Gamer.class);
Expand Down
4 changes: 2 additions & 2 deletions src/org/ggp/base/apps/player/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public void run()

private final JTextField portTextField;

private final JComboBox typeComboBox;
private final JComboBox<String> typeComboBox;

private Integer defaultPort = 9147;

Expand All @@ -75,7 +75,7 @@ public Player()
super(new GridBagLayout());

portTextField = new JTextField(defaultPort.toString());
typeComboBox = new JComboBox();
typeComboBox = new JComboBox<String>();
createButton = new JButton(createButtonMethod());
playersTabbedPane = new JTabbedPane();

Expand Down
8 changes: 4 additions & 4 deletions src/org/ggp/base/apps/server/Server.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public void run()
private final SchedulingPanel schedulingPanel;
private final LeaderboardPanel leaderboardPanel;

private final List<JComboBox> playerFields;
private final List<JComboBox<String>> playerFields;
private final List<JLabel> roleLabels;
private final JButton runButton;

Expand All @@ -100,7 +100,7 @@ public void run()

private final GameSelector gameSelector;
private final PlayerSelector playerSelector;
private final JList playerSelectorList;
private final JList<String> playerSelectorList;

private final Scheduler scheduler;

Expand All @@ -119,7 +119,7 @@ public Server()
playersPanel = new JPanel(new GridBagLayout());

roleLabels = new ArrayList<JLabel>();
playerFields = new ArrayList<JComboBox>();
playerFields = new ArrayList<JComboBox<String>>();
theGame = null;

shouldScramble = new JCheckBox("Scramble GDL?", true);
Expand Down Expand Up @@ -237,7 +237,7 @@ public void actionPerformed(ActionEvent evt) {
int playClock = (Integer)playClockSpinner.getValue();

List<PlayerPresence> thePlayers = new ArrayList<PlayerPresence>();
for (JComboBox playerField : playerFields) {
for (JComboBox<String> playerField : playerFields) {
String name = playerField.getSelectedItem().toString();
thePlayers.add(playerSelector.getPlayerPresence(name));
}
Expand Down
12 changes: 6 additions & 6 deletions src/org/ggp/base/util/ui/GameSelector.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
* @author Sam Schreiber
*/
public class GameSelector implements ActionListener {
JComboBox theGameList;
JComboBox theRepositoryList;
JComboBox<NamedItem> theGameList;
JComboBox<String> theRepositoryList;

GameRepository theSelectedRepository;
Map<String, GameRepository> theCachedRepositories;
Expand All @@ -47,10 +47,10 @@ public String toString() {
}

public GameSelector() {
theGameList = new JComboBox();
theGameList = new JComboBox<NamedItem>();
theGameList.addActionListener(this);

theRepositoryList = new JComboBox();
theRepositoryList = new JComboBox<String>();
theRepositoryList.addActionListener(this);

theCachedRepositories = new HashMap<String, GameRepository>();
Expand Down Expand Up @@ -102,11 +102,11 @@ public void repopulateGameList() {
}
}

public JComboBox getRepositoryList() {
public JComboBox<String> getRepositoryList() {
return theRepositoryList;
}

public JComboBox getGameList() {
public JComboBox<NamedItem> getGameList() {
return theGameList;
}

Expand Down
16 changes: 8 additions & 8 deletions src/org/ggp/base/util/ui/PlayerSelector.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public PlayerSelector() {
thePresenceManager = new PlayerPresenceManager();
}

class PlayerPresenceLabel extends JLabel implements ListCellRenderer {
class PlayerPresenceLabel extends JLabel implements ListCellRenderer<String> {
private static final long serialVersionUID = 1L;
private int maxLabelLength;

Expand All @@ -37,8 +37,8 @@ public PlayerPresenceLabel(int maxLabelLength) {
}

public Component getListCellRendererComponent(
JList list,
Object value,
JList<? extends String> list,
String value,
int index,
boolean isSelected,
boolean cellHasFocus) {
Expand Down Expand Up @@ -90,7 +90,7 @@ public Component getListCellRendererComponent(
}
}

class PlayerSelectorBox extends JComboBox implements Observer {
class PlayerSelectorBox extends JComboBox<String> implements Observer {
private static final long serialVersionUID = 1L;

public PlayerSelectorBox() {
Expand Down Expand Up @@ -122,7 +122,7 @@ public void observe(Event event) {
}
}

class PlayerSelectorList extends JList implements Observer {
class PlayerSelectorList extends JList<String> implements Observer {
private static final long serialVersionUID = 1L;

public PlayerSelectorList() {
Expand All @@ -133,7 +133,7 @@ public PlayerSelectorList() {
}

private void setAllPlayerItems() {
setListData(thePresenceManager.getSortedPlayerNames().toArray());
setListData(thePresenceManager.getSortedPlayerNames().toArray(new String[0]));
}

@Override
Expand Down Expand Up @@ -164,11 +164,11 @@ public PlayerPresence getPlayerPresence(String name) {
return thePresenceManager.getPresence(name);
}

public JComboBox getPlayerSelectorBox() {
public JComboBox<String> getPlayerSelectorBox() {
return new PlayerSelectorBox();
}

public JList getPlayerSelectorList() {
public JList<String> getPlayerSelectorList() {
return new PlayerSelectorList();
}
}

0 comments on commit b5eb509

Please sign in to comment.