This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

fieldName.setText is not setting text.

 
Andrew Geroge Alexander
Ranch Hand
Posts: 31
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

Background of problem : I have created a Form that has several Text field, trying to link to the backend DB to display data on the from.

Problem : I have used the fieldName.setText property to set the value that I am getting from the Query, for some reason it is not setting the value..

As you can see, the System.out.print does print the values right.. But I cannot see it on my Form view.. Why would that be?

Does it make a difference if they are on different panels? I have one jFrame and three jPanels.. All the text fields are scattered among these panels like Title maybe in Panel1 and F_Name in Panel2 etc....
 
Ranganathan Kaliyur Mannar
Bartender
Posts: 1101
10
Java Netbeans IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You mention that you added the field to 'Form'. What is Form? is it your own class? does it extend JPanel?

First of all, does your screen display properly i.e is the text field visible? I would suggest you to write a small program without the DB part and try the call to setText directly.
 
Andrew Geroge Alexander
Ranch Hand
Posts: 31
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Form is just the way I call it.. It is just a Panel with all the TextFields on it..

The text fields are all visible.. However I tried adding something like

Even which did not seem to appear..
 
Paul Clapham
Sheriff
Pie
Posts: 20196
26
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, clearly you've done something wrong then. But from the code you've posted, it's impossible to tell what that is. In fact we can't even tell what kind of component txt_TITLE is.

So you're going to have to post your code. But we don't want to see 900 lines of code, if that's what you have. What we need to see is a small example which demonstrates the problem. Read the page here: SSCCE which explains that in more detail.
 
Andrew Geroge Alexander
Ranch Hand
Posts: 31
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello.. Sorry it was something I did.. I called a non static function by creating an object, before the default constructor was called.. thus making the previous object void/overridden by the normal constructor.. So i deleted the default coding and it works..
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic