urgent. I posted this but no reply. so posting again. Sorry. Plz help

I am trying to display a JTable inside a JFrame .

The JFrame is inside a JDesktopPane.

My code is here below.

When I run this code only a blank frame comes up and I am not able to see the table.Why.

What changes should I make to this code. Please help me.

import java.awt.*;

import javax.swing.*;

import javax.swing.table.*;

public class DisplayTable1 extends JFrame

{

DefaultTableModel dtm;

JTable tbl;

JScrollPane s;

public DisplayTable1()

{

Container c=getContentPane();

//creating table

dtm = new DefaultTableModel();

tbl = new JTable(dtm);

s = new JScrollPane(tbl);

//desktopane and internalfame and adding table

final JDesktopPane dsk1 = new JDesktopPane();

c.add(dsk1);

JInternalFrame inf1 = new JInternalFrame("Internal Frame",true,true,true,true);

inf1.setSize(300,300);

Container con1=inf1.getContentPane();

con1.add(s);

inf1.setOpaque(true);

dsk1.add(inf1);

setSize(1000, 700);

setVisible(true);

}

public void paint(Graphics g)

{

super.paint(g);

dtm.setRowCount(5);

dtm.addColumn("PAYMENT NUMBER");

dtm.addColumn ("PAYMENT AMOUNT");

dtm.addColumn ("PRINCIPLE");

dtm.addColumn ("INTEREST");

dtm.addColumn("LOAN BALANCE");

for(int k=0;k<4;k++)

{

dtm.setValueAt(Integer.toString(k), k, 0);

dtm.setValueAt(Integer.toString(k), k, 1);

dtm.setValueAt(Integer.toString(k), k, 2);

dtm.setValueAt(Integer.toString(k), k, 3);

dtm.setValueAt(Integer.toString(k), k, 4);

}

}

public static void main(String args[])

{

DisplayTable1 aaa1=new DisplayTable1();

}

}

[1805 byte] By [qazwsx_qaza] at [2007-10-3 5:14:48]
# 1

You posted your question 30 minutes ago!!! Not only that, the code in the other posting was formatted to it was readable.

I was just about to answer that posting when I saw this.

People answer questions when they have time not becuase you think its urgent and you can't wait.

If you want help in the future I suggest you be more patient.

camickra at 2007-7-14 23:21:22 > top of Java-index,Desktop,Core GUI APIs...
# 2
You need to set each internal frame's visibility to true if you want to show it.Just add inf1.setVisible(true);after you instantiate it and your program should display properly.
MatthewJMurraya at 2007-7-14 23:21:22 > top of Java-index,Desktop,Core GUI APIs...
# 3
I am sorry sir
qazwsx_qaza at 2007-7-14 23:21:22 > top of Java-index,Desktop,Core GUI APIs...
# 4
thank you very much sir. It worked. Very kind of you. Thank you
qazwsx_qaza at 2007-7-14 23:21:22 > top of Java-index,Desktop,Core GUI APIs...