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.
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
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.
If you don't understand my answer, don't ignore it, ask a question.
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?
aa.textField: javax.swing.JTextField[,21,114,65x20,invalid,
Last edited by Norm; May 19th, 2012 at 12:41 PM.
If you don't understand my answer, don't ignore it, ask a question.
how it can be invisible if it is declared:
public JTextField textField;
and it is set:
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?
If you don't understand my answer, don't ignore it, ask a question.
what do you mean?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.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?
If you don't understand my answer, don't ignore it, ask a question.
i don't get it... sorry, my english skills are poor, specially about programming things
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.
If you don't understand my answer, don't ignore it, ask a question.
scorpas (May 21st, 2012)
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.