0

One of my JTable is update with a bean property(util.List).It is ok. But I want a column in my JTable named "Action". This column should have JComboBox for each row to do some thing for that row's data. I read this and it has some tutorials how to set a Jcombobox into a JTable row.

I use NetBeans IDE for coding. In the netbeans "Table Content" of the JTable display box under the Column tab, there are properties to set our JTable. I added a column for my "action" then set javax.swing.table.TableCellEditor as new DefaultCellEditor(comboBox) in "Editor" Options. Here I added a JComboBox combobox for the cell editor. But when I ran the project, there is no any combo box but only a text "Object" .(I had use Object as the Exression type of the column)

Any one tell me how can I insert a JCombobox into a JTable cell when JTable is bound to a beans propery . specially in NetBeans

divibisan
  • 11,659
  • 11
  • 40
  • 58
Débora
  • 5,816
  • 28
  • 99
  • 171
  • 1
    I don't recommend overusing NetBeans because you'll end up not understanding at all the code it has produced for you. If you want some help on this issue, you'll have to provide sample code (excerpted from what NetBeans has generated, but please don't post it all, because NetBeans generated code is terribly long and hard to understand!). – jfpoilpret Sep 26 '11 at 14:14
  • as already mentioned in the other thread: you _cant_ add an action with beansbinding, no way. There's an Action annotation in appframework - but that has nothing (as in really nothing at all) to do with beansbinding. – kleopatra Sep 26 '11 at 15:24
  • here's the other thread I meant in my previous comment http://stackoverflow.com/questions/7555377/how-to-bind-a-jbutton-in-beansbinding – kleopatra Sep 26 '11 at 15:28
  • I read your previous article.(Thanks for that). I meant by "action" not to add an action in beansbinding.But to the JComboox which is to be added into the table's cell. – Débora Sep 26 '11 at 16:14

1 Answers1

2

you forget to set DefaultCellEditor for that

mKorbel
  • 109,525
  • 20
  • 134
  • 319
  • Then what I put there? how I set a `JCombobox` ? – Débora Sep 26 '11 at 14:04
  • @Aash Maharoon post (edit your post) here http://sscce.org/, or follows code example from link that I posted – mKorbel Sep 26 '11 at 14:10
  • I have already mentioned about that link in my question.It has no answer. Here is not all about inserting a JCombobox but how to use Beansbinding with inserting a JCombobox. – Débora Sep 26 '11 at 14:19
  • JTable is auto generated by NetBeans. – Débora Sep 26 '11 at 16:21
  • There's a related example [here](http://stackoverflow.com/questions/7350445/how-do-i-get-the-cellrow-when-there-is-an-itemevent-in-the-jcombobox-within-the-c/7356518#7356518). – trashgod Sep 26 '11 at 16:32
  • Thanks.Adding only a JCombobox is not the problem. When the Jtable is bound to a util.List property,then adding a JCombobox to a column is the problem – Débora Sep 26 '11 at 16:49