stream = new FileInputStream(respath+"res/servers.txt");
}
BufferedReader in = new BufferedReader(new InputStreamReader(stream));
m_servers[0] = new Button(in.readLine());
m_servers[0].setSize(280, 24);
m_servers[0].setLocation(16, 32);
m_servers[0].setVisible(true);
m_servers[0].addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
GameClient.setHost(m_host[0]);
}
});
this.add(m_servers[0]);
m_host[0] = in.readLine();
m_servers[1] = new Button(in.readLine());
m_servers[1].setSize(280, 24);
m_servers[1].setLocation(16, 64);
m_servers[1].setVisible(true);
m_servers[1].addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
GameClient.setHost(m_host[1]);
}
});
this.add(m_servers[1]);
m_host[1] = in.readLine();
m_servers[2] = new Button(in.readLine());
m_servers[2].setSize(280, 24);
m_servers[2].setLocation(16, 96);
m_servers[2].setVisible(true);
m_servers[2].addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
GameClient.setHost(m_host[2]);
}
});
this.add(m_servers[2]);
m_host[2] = in.readLine();
m_servers[3] = new Button(in.readLine());
m_servers[3].setSize(280, 24);
m_servers[3].setLocation(16, 128);
m_servers[3].setVisible(true);
m_servers[3].addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
GameClient.setHost(m_host[3]);
}
});
this.add(m_servers[3]);
m_host[3] = in.readLine();
m_servers[4] = new Button(in.readLine());
m_servers[4].setSize(280, 24);
m_servers[4].setLocation(16, 160);
m_servers[4].setVisible(true);
m_servers[4].addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
GameClient.setHost(m_host[4]);
}
});
this.add(m_servers[4]);
m_host[4] = in.readLine();
/*
* Finally, check which servers don't exist and disable their buttons
*/
for(int i = 0; i < 5; i++) {
if(m_host[i].equalsIgnoreCase("-")) {
m_servers[i].setEnabled(false);
m_host[i] = "";
}
m_servers[i].setForeground(m_black);
}
} catch (Exception e) {
e.printStackTrace();
}
privateIP = new TextField();
privateIP.setLocation(16, 204);
privateIP.setSize(128, 24);
this.add(privateIP);
privateServer = new Button();
privateServer.setText(translate.get(2));
privateServer.setSize(128, 24);
privateServer.setLocation(168, 204);
privateServer.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {