Exemple #1
0
 public void addTileButton() {
   DefaultListModel lm = (DefaultListModel) gui.tileList.getModel();
   if (gui.tileList.getSelectedIndex() == -1) {
     tiles.add(ctx.players.local().tile());
     lm.addElement(ctx.players.local().tile().x() + ", " + ctx.players.local().tile().y());
   } else {
     tiles.add(gui.tileList.getSelectedIndex() + 1, ctx.players.local().tile());
     lm.add(
         gui.tileList.getSelectedIndex() + 1,
         ctx.players.local().tile().x() + ", " + ctx.players.local().tile().y());
   }
   gui.tileList.setModel(lm);
 }
Exemple #2
0
 public void removeTileButton(int index) {
   tiles.remove(index);
   DefaultListModel lm = (DefaultListModel) gui.tileList.getModel();
   lm.remove(index);
   gui.tileList.setModel(lm);
 }