-1

Right now, I am trying to create a table with custom code for my Java application (Swing GUI). I create the table with this code:

DefaultTableModel tm = new DefaultTableModel(9,5);

I got 5 columns with 9 rows for the table: I just want to rename/change the header text for the columns, because right now they have name like A,B,C,D and so on!

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Stoyan377
  • 11
  • 4
  • 2
    Try actually RTFM for the API being used. The clue is in the [constructors for `DefaultTableModel`](http://docs.oracle.com/javase/8/docs/api/javax/swing/table/DefaultTableModel.html#constructor.summary). As a general tip, don't come running to SO with every question that arises in programming. **Consult the documentation first.** – Andrew Thompson Dec 11 '16 at 13:34
  • Thank you for the advice! I found a solution! – Stoyan377 Dec 11 '16 at 13:50
  • *"I found a solution!"* Glad you got it solved! :) Now yo might answer your own question below (not as a comment). Or.. simply delete it using the link below the tags. – Andrew Thompson Dec 11 '16 at 14:00

1 Answers1

0

I used DefaultTableModel(Object[] columnNames, int rowCount) to solve my problem!

Stoyan377
  • 11
  • 4