我正在制作一个项目,当您点击按钮时,图片会显示在JPanel
中。
但是当我点击那个按钮时,没有任何反应。
如何修复此代码?
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
// button sluiten van de deur
try {
writer.println("execute(lock, \"aepu04:SI-Test\");");
writer.flush(); // flushes the buffer
String path = "http://chart.finance.yahoo.com/z?s=GOOG&t=6m&q=l";
System.out.println("Get Image from " + path);
URL url = new URL(path);
BufferedImage image = ImageIO.read(url);
System.out.println("Load image into frame...");
JLabel label = new JLabel(new ImageIcon(image));
JPanel panel = jPanel1;
panel.add(label);
panel.setVisible(true);
} catch (Exception ex) {
chatTextArea.append("Message was not sent. \n");
}