Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

JTable

 
Ranch Hand
Posts: 524
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,
could you kindly tell me how to do this. i have created a JTable with 100 rows and 5 columnc. what i want to do is i want to name the five columns. A,B,C....... appears now. i know i can use another constructor but the thing is i want to specify the number of rows in the same time. i would appriciate if you write down the code if you can.
thank you very much
 
Sheriff
Posts: 3036
12
Mac IntelliJ IDE Python VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JTable is a very flexible class, but that flexibility makes it a bit hard to use. The easiest way to get column names is to use the JTable(Object[][] rowData, Object[] columnNames) constructor. There are many other ways. In some cases, you will create your own TableColumnModel and add each column manually.
 
What are you saying? I thought you said that Santa gave you that. And this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic