我想写一个套接字程序......
Socket socket = new Socket("127.0.0.1",12345);
DataOutputStream output = new DataOutputStream( socket.getOutputStream() );
output.writeUTF("Hello");
output.writeUTF("World");
...
...
Run Code Online (Sandbox Code Playgroud)
"你好","世界"......首先到达哪个字符串?套接字是否保证订单?
我想使用JLabel(Icon)来显示来自我网站的图片(http://xxx.xxx.xxx.xxx/java_pic/test.jpg).我有一个新的JLabel和ImageIcon刷新按钮(为了获得最新的图像)程序运行成功...但是当我上传新图像以覆盖旧图像(http://xxx.xxx. xxx.xxx/java_pic/test.jpg),我按下刷新按钮......什么都没发生!我重启我的程序......现在出现了新图像......为什么?当我再次创建ImageIcon时,它不应该从网站重新加载图像吗?
public void refresh(){
URL iconUri = null;
iconUri = new URL("http://XXX.XXX.XXX.XXX/java_pic/test.jpg");
ImageIcon imageIcon = new ImageIcon(iconUri);
JLabel imageLabel = new JLabel(imageIcon);
frame.add(imageLabel);
...
...
}
Run Code Online (Sandbox Code Playgroud)
当我点击刷新按钮时,它会调用refresh()...为什么?谢谢!