Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

text field in new window  RSS feed

 
Johny Wyenski
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,

I'd like to add text field and read its value. I have posted this question on the other forum, but it was not in English language and finally the problem has not been solved.

The code which I have:



Previously I was trying to use



The application launches (in previous and actual version of code) but does not show any text box. How may I correct the code?

Regards!
 
John Jai
Rancher
Posts: 1776
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Change the class to extend JFrame and not Frame and try to add the text field's to its content pane like below -


You shall also change TextField to JTextField.
 
Johny Wyenski
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear John,

thank you for your answer! As I wrote in my first post, I have already tried it. So I change again to the previous version of code:



and I can see the same what previously:

cannot find symbol
symbol: method getContentPane()
location: class NameOfMyClass


The NetBeans IDE can create this symbol for me, but it still needs to be implemented (and I think I don't need to implement it but rather to change something in the code quoted above):



Regards!
 
John Jai
Rancher
Posts: 1776
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmm... did you try changing Frame to JFrame? I didn't see that modification in the code you posted.

public class NameOfMyClass extends JFrame
 
Johny Wyenski
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks!

OK, solved. I needed to add:



but also



Regards!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!