各位大侠,我想实现的是鼠标点击list中的一个元素,然后就弹出一个新的frame,但是我的是list中有好多个元素就弹出了好多个frame,本来我只想弹出一个frame,这个应该怎么实现呀,谢谢了哈 listTable.put(people,people+"("+sex+")");
chatList.add((String)listTable.get(people));
chatList.repaint();
chatList.addMouseListener(this);
这个是事件处理的代码
public void mouseClicked(MouseEvent e){
String withname=chatList.getSelectedItem().substring(0,chatList.getSelectedItem().indexOf("("));
if(u_name.equals(withname))
{
JOptionPane.showMessageDialog(null,"你不能和自己聊天","提示",JOptionPane.INFORMATION_MESSAGE);
}
else
{
new ChatwithSigle(u_name,withname);
}
}
chatList.add((String)listTable.get(people));
chatList.repaint();
chatList.addMouseListener(this);
这个是事件处理的代码
public void mouseClicked(MouseEvent e){
String withname=chatList.getSelectedItem().substring(0,chatList.getSelectedItem().indexOf("("));
if(u_name.equals(withname))
{
JOptionPane.showMessageDialog(null,"你不能和自己聊天","提示",JOptionPane.INFORMATION_MESSAGE);
}
else
{
new ChatwithSigle(u_name,withname);
}
}
http://topic.csdn.net/u/20090116/15/06f19cd7-a69a-4090-b807-847e38f484f0.html