hi guys, hope you are doing very well. I've been working on a program that if I enter lowercase letters in one textField the other should display it in capital letters with the help of Event Handling but I am constantly getting these two errors. I'm a beginner so would be really nice if you could help me out.
soche123
0
Junior Poster in Training
Recommended Answers
Jump to PostCode posting does work - start your message, click the code button you should see a new window in which you can post your code. If that's not working can you post a screen shot that shows what your'e trying?
Thanks
Jump to PostOK, I posted the code for you (just clicked the "code" button and pasted it in!).
Now, what exactly are the two errors you referred to?
Jump to Postr is defined as an ActionEvent (line 25) and ActionEvents do not have a getText() method, so that's why the compiler can't find it.
Probably what you want to do is to get the text from atextfield into a String, convert that to upper case, and set that text into …
Jump to PostgetSource is a method, so the syntax is
if (r.getSource() == abtn)
Fot getting the text fro a text field and updating a text field you can use the
getText()
andsetText(String s)
methods that every JTextField has.
All 13 Replies
soche123
0
Junior Poster in Training
soche123
0
Junior Poster in Training
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
soche123
0
Junior Poster in Training
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
soche123
0
Junior Poster in Training
soche123
0
Junior Poster in Training
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
soche123
0
Junior Poster in Training
soche123
0
Junior Poster in Training
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
soche123
0
Junior Poster in Training
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.