Hi all,
I have a little problem. I create a GUI Application using Netbeans IDE 7.1. I want to pass a string from static method to the JTextArea. Here is the problem:
1. the JTextaArea variable name is declared non-static by IDE (I can't even modify it to static type).
2. the method to which I want to pass the JTextArea is static (surely I can't modify it since its a third party library).
Here is the snippet declaration by Netbeans GUI:
// Variables declaration - do not modify
.......
private javax.swing.JLabel machinePortLabel;
private javax.swing.JTextField machinePortTextField;
private javax.swing.JTextArea machineLoggingTextField;
// End of variables declaration
Here is the the static method:
public class MachineAgent extends Agent{
private boolean finished = false;
final String newline = "\n";
@Override
public void setup() {
addBehaviour(new SimpleBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public void action() {
MachineFrame.getMachineLoggingTextField().getText( ); //Compiler complain "non-static method //getMachineLoggingTextField() can not be referenced from a static context.
}
@Override
public boolean done() {
return finished;
}
});
}
}
Can anyone offer a solution to the problem? A useful hint or clue will be appreciated. Thanks.