I have a hashtable storinga list of computer names and ip addresses in a LAN.
basically what happens is a JList displays the names, you click on the one you want, and in the listener there is a call to messenger class which takes an InetAddress as a parameter (to make connections to remote host).
Anyway, my problem is that the address in the hashtable is being stored as an object, kind of generically I suppose.
I keep trying to find a way to get the value of the hashtable as an InetAddress to send to the other class.
Can anyone see what I'm doing wrong here?
truncated code
public void valueChanged(ListSelectionEvent le)
{
String selection = (String) userList.getSelectedValue(); //gets selected list cell as string(hostname
System.out.println("Current selection: " + clientList.get(selection));
try
{
InetAddress sendTo = clientList.get(selection) ; //HELP ME HERE PLEASE..
Messenger messenger = new Messenger(sendTo);
}
catch(IOException ioException)
{
displayMessage("Error resolving client address");
}
}
I'm going to keep looking but if anyone can help you'll save my life right now.
Thanks!

New Topic/Question
Reply


MultiQuote





|