单击JButton并打开file.java

时间:2016-10-19 15:43:17

标签: java swing netbeans jbutton

I have a jComoBox and JButton NewJDialog.java. How to pen A.java when i select "A" in JComboBox?

        if (jComboBox1.getSelectedItem() == "A"){
        A.java.setVisible(true);
    }
    else {
        dispose();
    }
}  

1 个答案:

答案 0 :(得分:1)

如果您尝试打开文件,可以使用像这样的桌面对象。

Desktop d = Desktop.getDesktop();
d.open("your File object here");