Как сделать кнопку, которая при нажатии открывает каталог% appdata%?
Я сделал кнопку, но сейчас не знаю, как заставить ее открыть определенную директорию, например%appdata%
когда кнопка нажата.
Вот код - & gt;
//---- button4 ----
button4.setText("Texture Packs");
button4.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e)
{
JFileChooser fileChooser=new JFileChooser("%appdata%");
int status = fileChooser.showOpenDialog(this);
fileChooser.setMultiSelectionEnabled(false);
if(status == JFileChooser.APPROVE_OPTION) {
File file = fileChooser.getSelectedFile();
// do something on the selected file.
}
}
И я хочу сделать что-то вроде этого - & gt;
private void button4MouseClicked(MouseEvent e) throws IOException {
open folder %appdata%
// Open the folder in the file explorer not in Java.
// When I click on the button, the folder is viewed with the file explorer on the screen
}