overwrite existing value of a textbox with null

  • Thread starter shruti tiwari via JavaKB.com
  • Start date
S

shruti tiwari via JavaKB.com

hi
i am filling up a table of jTextbox with values from a database.when there
are matching records it displays the required value allright but the
problem arises when the database returns no record for that textbox.in this
case we want it to display no value n return null or "" but is still
displays the last displayed value...code:

public void createtable(){
t=new JTextField[5][7];
int j=0,k=0;
//JOptionPane.showMessageDialog(null,"Testing123");
for(i=0;i<5;i++){
for(l=0;l<6;l++){

t[l] =new JTextField();
}
}
for(i=0;i<5;i++){
l=0;
//System.out.print(j);
k=0;
while(l<6){

// System.out.print(j);
t[l].setText(null);//to initialize textbox to null
t[l].setPreferredSize(new java.awt.Dimension(80, 20));
t[l].setEnabled(false);
t[l].setBounds(160+k,180+j,80,20);
getContentPane().add(t[l]);
k=k+80;
l++;
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top