1

Is it possible to add some Menu type (drop down) or a menu item to the column header of JTable in Java swing?

If possible please tell me the approach that I can use.

mKorbel
  • 109,107
  • 18
  • 130
  • 305
Vinay Bedre
  • 356
  • 1
  • 6
  • 16
  • See also [How can I put a control in the JTableHeader of a JTable?](http://stackoverflow.com/questions/7137786/how-can-i-put-a-control-in-the-jtableheader-of-a-jtable) – trashgod Oct 31 '11 at 15:37

1 Answers1

1

this is the example ...
Or..
take the table header by header = table.getTableHeader(). it return a component. You can add other components like buttons etc..and u can add component on this by header.add(/*component which u want to add*/)..
and u also need to set layout Before adding component: ex: header.setLayout(new BorderLayout());

Sumit Singh
  • 24,095
  • 8
  • 74
  • 100
  • I had some problems with the example, commented [here](http://stackoverflow.com/questions/7092219/exception-in-thread-awt-eventqueue-0-java-lang-classcastexception-javax-swing). – trashgod Oct 31 '11 at 15:38