Is the textfield whose setText() method you are calling, visible in the GUI?
Print out the values of aa and aa.textField where the call to setText() is.
Printable View
Is the textfield whose setText() method you are calling, visible in the GUI?
Print out the values of aa and aa.textField where the call to setText() is.
Code :aa: Zaidimas.baaaa@b162d5 aa.textField: javax.swing.JTextField[,21,114,65x20,invalid,layout=javax.swing.plaf.basic.BasicTextUI$UpdateHandler,alignmentX=0.0,alignmentY=0.0,border=javax.swing.plaf.BorderUIResource$CompoundBorderUIResource@1cfb549,flags=296,maximumSize=,minimumSize=,preferredSize=,caretColor=sun.swing.PrintColorUIResource[r=51,g=51,b=51],disabledTextColor=javax.swing.plaf.ColorUIResource[r=184,g=207,b=229],editable=true,margin=javax.swing.plaf.InsetsUIResource[top=0,left=0,bottom=0,right=0],selectedTextColor=sun.swing.PrintColorUIResource[r=51,g=51,b=51],selectionColor=javax.swing.plaf.ColorUIResource[r=184,g=207,b=229],columns=0,columnWidth=0,command=,horizontalAlignment=LEADING]
Is the textfield whose setText() method you are calling, visible in the GUI?
Quote:
aa.textField: javax.swing.JTextField[,21,114,65x20,invalid,
how it can be invisible if it is declared:
Code :public JTextField textField;
and it is set:
Code :textField.setVisible(true);
I do not think You can have a non window component visible by itself without its containing window being visible.
How many instances of the window/frame class that contains the textfield does the code create? Are all of them visible?
what do you mean?Quote:
I do not think You can have a non window component visible by itself without its containing window being visible.
i can see that textbox, when i run my project.
and as i said, if I use setText() method in the same (baaaa) class, i can see the value of the textbox.
one instance of a frame class is in a ball class where i'm trying to set that textfield value (after ball hits a block). thats all.Quote:
How many instances of the window/frame class that contains the textfield does the code create? Are all of them visible?
How many instances of the frame with the textfield do you create? Are they all visible?
i don't get it... sorry, my english skills are poor, specially about programming things :D
Add a println next to the statement that creates the textfield. If it prints more than once you have two text fields, one visible and one hidden. If you change the contents of the hidden one you will not see any changes in the visible one.
Otherwise you will have to create a small, simple program that compiles, executes and shows the problem. I don't know what the code is doing without seeing it and and having a version I can test.
actually, i rewrote my JFrame class.
delete those instance of JFrame class in other classes.
when i call setText() method by just writing:
class_name.textField.setText(Integer.toString(app. score));
and it works!
Forum was offline, im allready finished my project.
Tomorow i will try to get some grade from my teacher:)
thanks Norm, for trying.