Monday, February 1, 2010

Quick way to disable table header in JTable

Last week was Java week. It involved quickly adding a new tab to an existing Java applet application. The layout has a nice larger table header section and allows for the table itself to have a sub-header.

That is pretty slick. Until you don't need a sub-header :). After a bit of searching I found a pretty Perl-ish way to disable table headers in Java's JTable.
myTable.setTableHeader(null); 
I kept looking for a disableTableHeader method.

This week its off to Excel, Web Posts and VBA again... yikes.

6 comments:

  1. There is another way too,
    MyTable.getTableHeader().setEnabled(false);
    It's going to diable the table header. It's work fine for me. The table header it would be displayed but You can't click on it or drag or edit, etc. (sorry for my english)

    ReplyDelete
  2. I have read your blog its very attractive and impressive. I like it your blog.

    Java Training in Chennai Core Java Training in Chennai Core Java Training in Chennai

    Java Online Training Java Online Training Core Java 8 Training in Chennai Core java 8 online training JavaEE Training in Chennai Java EE Training in Chennai

    ReplyDelete
  3. Java Training Institutes Java Training Institutes Java EE Training in Chennai Java EE Training in Chennai Java Spring Hibernate Training Institutes in Chennai J2EE Training Institutes in Chennai J2EE Training Institutes in Chennai Core Java Training Institutes in Chennai Core Java Training Institutes in Chennai

    ReplyDelete
  4. Java Online Training Java Online Training Java Online Training Java Online Training Java Online Training Java Online Training

    Hibernate Training Institutes in ChennaiHibernate Training Institutes in Chennai Hibernate Online Training Hibernate Online Training Hibernate Training in Chennai Hibernate Training in Chennai

    ReplyDelete
  5. This information is impressive; I am inspired by your post writing style & how continuously you describe this topic. Java Training in Chennai

    ReplyDelete
  6. Needed to compose you a very little word to thank you yet again regarding the nice suggestions you’ve contributed here.

    Java Training in Bangalore

    ReplyDelete