i have a JTextField inside a JFrame, and I want it to find the file path of a file whenever the file is dragged in to the JTextField. Should I use some kind of Listener? How should I do this?
public class UI extends JFrame{
String s;
JTextArea textfield = new JTextArea();
public UI(){
setVisible(true);
setSize(1000,800);
setResizable(false);
setTitle("Cloavy Compiler");
textfield.setSize(1000,800);
add(textfield);
}
public void onDrag(){
s = filepath;
}
}
Thanks for your time.
Find answers in the Drag and Drop and Data Transfer lesson of the tutorial.