我想在新的JFrame窗口方法中使用一個字符串(在我的主要方法中初始化)。我有以下代碼:將以前使用的字符串導入新方法
public static void main(String[] args){
WebElement link = driver.findElement(By.xpath("//*[@id='pagecontainer']/section/ul/li[1]/a"));
String linkLocation = link.getAttribute("href");
}
我的主要方法和下面的代碼JButton的在我的JPanel
public void actionPerformed(ActionEvent e)
{
desk.browse(new URI(linkLocation));
}
我如何得到這個工作?
你有沒有在''linkLocation''獲取'JButton'的地方? – Arvind