Пример #1
0
 private void setLoadOutForEscortGame() {
   possibleUnitList.removeAll();
   possibleUnitListModel.removeAllElements();
   userUnitListModel.removeAllElements();
   userUnitList.removeAll();
   userUnitListModel.addElement(new SoldierUnit("Alice"));
   userUnitListModel.addElement(new SoldierUnit("Bob"));
   userUnitListModel.addElement(new SoldierUnit("Charlie"));
   userUnitListModel.addElement(new SoldierUnit("Danielle"));
   userUnitListModel.addElement(new EscortUnit("Eve", 0));
   possibleUnitList.setEnabled(false);
   userUnitList.setEnabled(false);
   readyButton.doClick();
 }
Пример #2
0
  public void removePictures() {
    entrys.removeAll();
    v_file.removeAllElements();
    v_names.removeAllElements();

    entrys.getSelectedValues();
  }
Пример #3
0
  public void connectToServer() {
    // TODO get port?
    String ip = "";
    while (ip.isEmpty()) {
      ip = JOptionPane.showInputDialog("Server address:", "localhost");
      if (ip == null) {
        return;
      }
    }

    if (ip != null) {
      serverC = ip;
      serverPort = 10000;
      roomList.removeAll();

      try {
        serverSocket = new Socket(serverC, serverPort);
        inServer = new BufferedReader(new InputStreamReader(serverSocket.getInputStream()));
        outServer = new PrintWriter(serverSocket.getOutputStream());

        getList();
        connectedToServer = true;
        btnConnectServer.setText("Disconnect from server");
        enableButtons(true);
      } catch (Exception e) {
        msgChat(e.getMessage());
      }
    }
  }
  private void loadList(JList list) {
    list.removeAll();
    profiles = parentGenerator.getProfiles();
    DefaultListModel model = new DefaultListModel();
    int i = 0;
    int foundLastProfile = -1;
    for (Profile p : profiles) {

      // Check that this profile says it's for this machine
      if (ProfileUtils.shouldDisplay(p) || filterBox.isSelected()) model.addElement(p.toString());
      if (p.toString().equals(Base.preferences.get("lastGeneratorProfileSelected", "---"))) {
        Base.logger.fine("Selecting last used element: " + p);
        foundLastProfile = i;
      }
      i++;
    }
    list.setModel(model);
    list.clearSelection();
    if (foundLastProfile != -1) {
      list.setSelectedIndex(foundLastProfile);
      doneButton.setEnabled(true);
      doneButton.requestFocusInWindow();
      doneButton.setFocusPainted(true);
    }
  }
Пример #5
0
 public void setPictures(File[] e) {
   entrys.removeAll();
   v_file.removeAllElements();
   v_names.removeAllElements();
   for (int i = 0; i < e.length; i++) {
     File entry = e[i];
     v_file.add(entry);
     v_names.add(entry.getName());
   }
   entrys.setListData(v_file);
 }
Пример #6
0
 private void setUpUnitLists() {
   possibleUnitList.removeAll();
   possibleUnitListModel.removeAllElements();
   userUnitListModel.removeAllElements();
   userUnitList.removeAll();
   System.out.println("units size: " + units.size());
   if (units.size() == 0) {
     possibleUnitListModel.addElement(new MeleeUnit("-----"));
     possibleUnitListModel.addElement(new RocketUnit("-----"));
     possibleUnitListModel.addElement(new SoldierUnit("-----"));
     possibleUnitListModel.addElement(new EngineerUnit("-----"));
     possibleUnitListModel.addElement(new DemolitionUnit("-----"));
     possibleUnitListModel.addElement(new ExplosivesUnit("-----"));
   } else {
     for (Unit u : units) possibleUnitListModel.addElement(u);
   }
   possibleUnitList.setEnabled(true);
   userUnitList.setEnabled(true);
   possibleUnitList.repaint();
   possibleUnitList.revalidate();
 }
Пример #7
0
  public void populate_slot_list(JList a_slot_list) {
    String l_slot_string_list[] = new String[g_slot_count];
    a_slot_list.removeAll();

    for (int l_slot = 0; l_slot < g_slot_count; l_slot++) {
      int blocks_used = get_blocks_used(l_slot);
      String l_slot_string = l_slot + 1 + ". ";

      if (blocks_used > 0) {
        l_slot_string += get_file_name(l_slot);
        l_slot_string += "." + get_version(l_slot);
        l_slot_string += " " + blocks_used;
      }

      l_slot_string_list[l_slot] = l_slot_string;
    }

    a_slot_list.setListData(l_slot_string_list);
  }
  private void updateList() {
    list.removeAll();
    DefaultListModel model = new DefaultListModel();
    if (shapefile == null) {
      return;
    }
    if (new File(shapefile.replace(".shp", ".dbf")).exists()) {

      try {
        AttributeTable table = new AttributeTable(shapefile.replace(".shp", ".dbf"));
        DBFField[] fields = table.getAllFields();
        for (DBFField field : fields) {
          model.add(model.size(), field.getName());
        }
      } catch (Exception e) {

      }
    } else {
      model.add(0, "");
    }
    list.setModel(model);
  }
 private void loadList(JList list) {
   list.removeAll();
   List<Profile> profiles = getProfiles();
   DefaultListModel model = new DefaultListModel();
   int i = 0;
   int foundLastProfile = -1;
   for (Profile p : profiles) {
     model.addElement(p);
     if (p.toString().equals(Base.preferences.get("lastGeneratorProfileSelected", "---"))) {
       Base.logger.fine("Selecting last used element: " + p);
       foundLastProfile = i;
     }
     i++;
   }
   list.setModel(model);
   list.clearSelection();
   if (foundLastProfile != -1) {
     list.setSelectedIndex(foundLastProfile);
     generate.setEnabled(true);
     generate.requestFocusInWindow();
     generate.setFocusPainted(true);
   }
 }
Пример #10
0
 public void setSelectingList(String[] sCharacters) {
   selectingList.removeAll();
   selectingList.setListData(sCharacters);
 }
 public void refresh() {
   list.removeAll();
   list.setListData(SistemaCocheras.getSistemaCocheras().listarAutos());
 }
 protected void updateQueryList() {
   queryNameList.removeAll();
   queryNameList.setListData(queries.values().toArray(new DataSetQuery[queries.size()]));
 }