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++;
}
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++;
}