2010-06-29 94 views

回答

3

這是一個沒有多餘的做法。

jList1.addListSelectionListener(this); 

public void valueChanged(ListSelectionEvent e) { 
    if (e.getValueIsAdjusting()) 
     return; 

    String url = (String)jList1.getSelectedValue(); 

    //Assume browser is supported on Desktop API 
    Desktop.getDesktop().browse(new URI(url)); 
} 

我在這裏使用默認模型,顯示的值是URL。在JDK 1.6上運行

+0

是的,找到了一個類似於您的解決方案,謝謝。 – Delanoy 2010-06-30 02:14:04