我需要一种方法来允许我的程序在调用此方法后继续运行代码。
目前,它等待半小时,获取信息,将其存储到对象 WeatherCard,并显示它,然后重复。但它挂在 JOptionPane 上。我需要一种方法来使程序要么继续在 JOptionPane 下方运行,要么在大约 10 秒后关闭窗格。我不确定如何在我的代码中工作,目前
public void printWeatherCard(WeatherCard w, JFrame controlFrame) throws MalformedURLException, IOException{
/* Displays a dialog box containing the temperature and location */
BufferedImage img = ImageIO.read(new URL(w.imgSrc));
ImageIcon icon = new ImageIcon(img);
JOptionPane.showMessageDialog(controlFrame, "It is currently " + w.currentTemp + " \u00B0 F in " + w.location.city + ", " + w.location.state + ".\nCurrent humidity: " + w.currentHumidity +
"%.\nChance of precipitation: " + w.chancePrecip + "%.", "Weather Update: " + w.location.zipCode, JOptionPane.INFORMATION_MESSAGE, icon);
}