By example, I want to take the value from an JTextField. In the JFrame I can do this with a simple txtField.getText(), but how I do passing the JFrame like parameter?
static boolean validateFields(Webcrawler wc) {
try {
//I created the txtUrl in the original JFrame, I can take him there,
//but not here.
//The code is from the JFrame is generated by Netbeans.
wc.getTxtUrl().getText(); //<-- is something like this I want to do.
return true;
} catch (Exception e) {
return false;
}
}
Most probably the member variables for your input widgets (like JTextFields) are private and hence inaccessible from the outside.
Either declare them public, or write accessor functions for their values. Something on the line of (inside your JFrame or a class derived from that JFrame if it is created by a third party: