Hi
I am getting to use the NetBeans and Java proper (instead of the framework on a server).
However, this poses different problems. First one I have is this:
I have created a form using NetBeans.
In the code of the form I want to update a labels text with something else.
I see that there is already a variable that NetBeans added and uses to add the JLabel to the form.
When I try to use it though, I get a NullPointerException. Looks like it has lost the reference it previously used to create the JLabel.
So I'm doing it wrong, I know this. So how do I change the text?
Java code : I call this after the form is visible.
Note: I cannot change the code generated for the form as it will be overwritten if I move anything on the form in design...
jlblusr is a JLabel it already used to addComponent to the form.
I am getting to use the NetBeans and Java proper (instead of the framework on a server).
However, this poses different problems. First one I have is this:
I have created a form using NetBeans.
In the code of the form I want to update a labels text with something else.
I see that there is already a variable that NetBeans added and uses to add the JLabel to the form.
When I try to use it though, I get a NullPointerException. Looks like it has lost the reference it previously used to create the JLabel.
So I'm doing it wrong, I know this. So how do I change the text?
Java code : I call this after the form is visible.
Code:
public void debugChangeLabels(){
//debug - labels
if( sessionApp == null ) { sessionApp = "Session Nada"; }
if( usuario == null ){ usuario = "usr nada"; }
jlblsess.setText("hhh");
//jlblusr.setText(sessionApp);
//jlblsess.setText(""+usuario);
}
jlblusr is a JLabel it already used to addComponent to the form.