I want combo box in jtable visible from start not when i click the cell... any idea?

Sorry my drawing isnt very good.... It look like figure A , but i want it to look like Figure B from start. Any one who used combobox in table has already experienced it...

Attachments diagram.jpg 12.69 KB

@Majestic please check my post http://stackoverflow.com/questions/6261017/how-to-add-different-jcombobox-items-in-a-column-of-a-jtable-in-swing/6261853#6261853 and then really ask the question, sure there are lots of ways how to implements that, anyway basic tutorial show this issue in low lever form http://download.oracle.com/javase/tutorial/uiswing/components/table.html#combobox examples for JTable http://www.java2s.com/Code/Java/Swing-JFC/Table.htm (TableCellRenderer + TableCellEditor)

Edited 5 Years Ago by mKorbel: n/a

mkorbel please check the question.................................. Thank you for your help

@Majestics, just joke, its Friday OT day > this quoestion invoked only I want to cleaned up my car <

Try using this for your cell renderer. You can pass it the combo box that you are using for the cell editor.

class CheckBoxCellRenderer implements TableCellRenderer {
        JComboBox combo;
        public CheckBoxCellRenderer(JComboBox comboBox) {
            this.combo = new JComboBox();
            for (int i=0; i<comboBox.getItemCount(); i++){
        public Component getTableCellRendererComponent(JTable jtable, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
            return combo;

On your table column, column.setCellRenderer(new CheckBoxCellRenderer(comboBox));

Edited 5 Years Ago by Ezzaral: n/a

Thanx ezzaral , i m dying to check it , if it work u rock 10000000000000000000000000 times.

Yes it worked... thanx alot... but my table has three combo boxes... it worked great for only one other two are not working properly..... any idea?

It would really depend on how you created the renders and assigned them to the column. If you did it the same way as the first then I don't see any reason why it would not work fine.

This question has already been answered. Start a new discussion instead.