title: How to create a JList which holds Parameters?
body: <p>Hi i'm trying to make a <code>JList</code> but it takes 2 Parameters. The list is a list of servers.</p>
  
  <pre><code>public class MainMenu extends JPanel {
  
      Kingdomcraft kd;
      Screen screen;
      JButton playSP;
      JButton playMP;
      JButton settings;
      JButton quit;
      JButton createWorld;
      JButton addServer;
      JSlider sound;
      JSlider light;
      @SuppressWarnings("rawtypes")
      JList worldList;
      JList serverList;
  
      private Preferences prefs;
      private int soundLevel;
      private int lightLevel;
  
      public void run() {
  
          kd = new Kingdomcraft();
          screen = new Screen();
          playSP = new JButton("Singleplayer");
          playMP = new JButton("Multiplayer");
          settings = new JButton("Settings");
          quit = new JButton("Quit");
          createWorld = new JButton("Create World");
          addServer = new JButton("Add Server");
          sound = new JSlider();
          light = new JSlider();
          prefs  = Preferences.userNodeForPackage(MainMenu.class);
          soundLevel = prefs.getInt("SOUND_LEVEL", 50);
          lightLevel = prefs.getInt("LIGHT_LEVEL", 50);
          worldList = new JList();
          serverList = new JList();
  
          this.setBackground(Color.BLACK);
          this.setLayout(null);
  
          if (kd.inMainMenu) {
  
              add(createWorld);
  
              createWorld.setBounds(170, 10, 150, 35);
  
              add(playSP);
  
              playSP.setBounds(10, 10, 150, 35);
  
              playSP.addActionListener(new ActionListener() {
  
                  public void actionPerformed(ActionEvent e) {
  
                      remove(sound);
                      remove(light);
                      remove(addServer);
                      repaint();
                      add(createWorld);
  
                      createWorld.setBounds(170, 10, 150, 35);
                  }
              });
  
              add(playMP);
  
              playMP.setBounds(10, 60, 150, 35);
  
              playMP.addActionListener(new ActionListener() {
  
                  public void actionPerformed(ActionEvent e) {
  
                      remove(sound);
                      remove(light);
                      remove(createWorld);
                      repaint();
  
                      add(addServer);
  
                      addServer.setBounds(170, 60, 150, 35);
                  }
              });
  
              add(settings);
  
              settings.setBounds(10, 110, 150, 35);
  
              settings.addActionListener(new ActionListener() {
  
                  public void actionPerformed(ActionEvent e) {
  
                      remove(createWorld);
                      remove(addServer);
                      repaint();
                      add(sound);
  
                      sound.setBounds(170, 110, 150, 35);
                      sound.setMinimum(0);
                      sound.setMaximum(100);
                      sound.setValueIsAdjusting(true);
                      sound.setValue(soundLevel);
                      sound.setToolTipText("Audio: " + soundLevel + "%");
                      sound.addChangeListener(new ChangeListener() {
  
                          public void stateChanged(ChangeEvent e) {
  
                              soundLevel = sound.getValue();
  
                              sound.setToolTipText("Audio: " + soundLevel + "%");
  
                              prefs.putInt("SOUND_LEVEL", soundLevel);
                          }
                      });
  
                      add(light);
  
                      light.setBounds(330, 110, 150, 35);
                      light.setMinimum(0);
                      light.setMaximum(100);
                      light.setValueIsAdjusting(true);
                      light.setValue(lightLevel);
                      light.setToolTipText("Brightness: " + lightLevel + "%");
                      light.addChangeListener(new ChangeListener() {
  
                          public void stateChanged(ChangeEvent e) {
  
                              lightLevel = light.getValue();
  
                              light.setToolTipText("Brightness: " + lightLevel + "%");
  
                              prefs.putInt("LIGHT_LEVEL", lightLevel);
                          }
                      });
                  }
              });
  
              add(quit);
  
              quit.setBounds(10, 160, 150, 35);
  
              quit.addActionListener(new ActionListener() {
  
                  public void actionPerformed(ActionEvent e) {
  
                      System.exit(ABORT);
                  }
              });
  
          }
      }
  }
  </code></pre>
  
  <p>The world list appears when you click the Multiplayer <code>JButton</code>.
  Also when you click the Multiplayer <code>JButton</code> a <code>JButton</code> appears named Add Server.
  Effectively when you add a new server that server would appear on the newly created JList.</p>
  
  <p>How would I do this? </p>
  
  <p>edit: By the way the 2 parameters are Strings serverName, and ServerIP.</p>