public void addRowsAntGrouping(){
			
			Vector vectorAddRow = new Vector();
			
			vectorAddRow.add("");
			vectorAddRow.add("");
			((DefaultTableModel)jTableAntGrouping.getModel()).addRow(vectorAddRow);
			
		}

Hi,
I am in need of replacing the textfield of a table with combobox. the rows in the table are declared as vectors. there are two fields in the table. the first field is text and second is a combobox. can u please help me. thanx in advance.

Recommended Answers

All 3 Replies

The vector contains the data in the cells, not how it is to be displayed. What you need to change is the CellRenderer.

See the Swing JTable Tutorial paying special attention to the Using Custom Renderers section.

hi,
i viewed the site but i need whether the combobox can be placed as an object inside the vector.

i need like this

Vector vectorAddRow = new Vector();

vectorAddRow.add("");
vectorAddRow.add(combobox);

please make it clear that a combobox can be an object that needs to be placed in vector.

thankx for ur reply.

What did I say? I said the Vector contains only the values, not the views. You need to declare and use a specific Renderer on the Column that needs one. Read the tutorial again, because you seemingly did not understand it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.