private class myMouseAdapter extends MouseAdapter
{
public void mouseClicked(MouseEvent e)
{
if(e.getClickCount() == 2)
{
try
{
int index = list.locationToIndex(e.getPoint());
PeerID id = (PeerID)vec.get(index);
JxtaSocket sock = new JxtaSocket(m_group, id, m_pipeAdv, 30000,true);
sock.setOutputStreamBufferSize(256*256);
MessageFrame f = new MessageFrame(sock,name);
f.setVisible(true);
f.listen();
}
finally
{
System.exit(0);
}
}
}
}
private class myWindowAdapter extends WindowAdapter
{
public void windowClosing(WindowEvent e)
{
synchronized(Main.m_map)
{
try
{
FileOutputStream fout = new FileOutputStream("friend.list");
ObjectOutputStream oout = new ObjectOutputStream(fout);
oout.write(Main.m_map); oout.close();
fout.close();
}
finally
{
System.exit(0);
}
}
}
}
}首先,我没有打错,函数在其他类也确实存在。红色的地方就是报错的地方,第一个报name 可以在 java.awt.component中访问private
第二个报:找不到符号 着急呀!
{
public void mouseClicked(MouseEvent e)
{
if(e.getClickCount() == 2)
{
try
{
int index = list.locationToIndex(e.getPoint());
PeerID id = (PeerID)vec.get(index);
JxtaSocket sock = new JxtaSocket(m_group, id, m_pipeAdv, 30000,true);
sock.setOutputStreamBufferSize(256*256);
MessageFrame f = new MessageFrame(sock,name);
f.setVisible(true);
f.listen();
}
finally
{
System.exit(0);
}
}
}
}
private class myWindowAdapter extends WindowAdapter
{
public void windowClosing(WindowEvent e)
{
synchronized(Main.m_map)
{
try
{
FileOutputStream fout = new FileOutputStream("friend.list");
ObjectOutputStream oout = new ObjectOutputStream(fout);
oout.write(Main.m_map); oout.close();
fout.close();
}
finally
{
System.exit(0);
}
}
}
}
}首先,我没有打错,函数在其他类也确实存在。红色的地方就是报错的地方,第一个报name 可以在 java.awt.component中访问private
第二个报:找不到符号 着急呀!
//你能保证你的sock一定能建立成功吗?
第一句:这个是一个构造函数,我觉得好像是函数类型不对,原本第二个参数类型是String,但是这个name显示成绿色,说:name 可以在 java.awt.component中访问private 不知为何 莫非重复了参数?
第二句:oout.write(Main.m_map); 其中Main.m_map是个HashMap型,莫非也是这个类型问题?但是我如果想输出这个HashMap呢?