I am supposed to create a table and all components of the second column are combo boxes. When I click on the combo box cells I can access the combo boxes drop down menu fine. However , there is no way for the user to know that the cells are combo boxes unless they click on the corresponding cells. Below my code. Any suggestions? Thanks for your help.
Thanks for your reply the other day regarding how to render JCombo boxes in table cells.
I am facing a similar problem right now and although I am tweeking the Renderer in my code as much as I can I cannot seem to get around it. That is why I was wondering if you could have a look at my code and help me out please. So basically all I am seeing in the table display is the references to my comboboxes such as : RulesParameterJComboBox[,0,0,0x0,invalid,layout=com.sun.java.com.sun.java.swing.plaf.windows ..........
Her is the code for the domain class :ResultCodesData
There is the code for : ResultCodesTableColumn
Please keep in mind that RulesParameterJComboBox extends class JCombobox
code for the TableModel :
code for Table class
Also for some reason, I cannot select the cells individually , all I can select are the rows. Hope it helps.
I am sorry to insist but I do not understand your response. Which getValue method are you talking about? Are you talking about getValueAt method from the ResultCodesTableModel class or some getvalue method from the ResultCodesTable?
As far as the Model/View Concept is concerned, this is my understanding for tables :
the Table Model contains the actual data. This is why my ResultCodesTableModel contains two critical attributes :
1- Vector<TableColumnData> : a vector (or collection) containing the table column names
2- Vector<T> : a vector (or collection) containing the actual data
In my case for testing purposes, I hard coded the Table Model so that it actually contains all table columns names and the actual data.
Each row in my table will be a ResultCodesData :
Hence the code below :
The View for tables is taken care of by the JTable class, this is why my ResultCodesTable (which extends JTable) is as follows :
I have looked at many posts on forums and it looks like usually when there is a rendering issue - which in my case is a JCombox rendering issue - people should override the getCellRenderer method which I attempted but it does not work. This is why I do not understand what getValue method you are talking about. Could you please be more specific? there is no getValue method in the JTable class to override and there is getValueAt method in the table Model. If you are talking about the latter I do not know how to adjust it to reflect my actual data on the View (i.e when my Jtable is supposed to render my actual model). Thanks for your help.