How to store multiple values in a JTable row as a JCombobox

Hashmap contains key and value(result of parsing an XML). Hashmap contains things in the way that key is a string and value is a vector. A key may have single value in the vector or mutiple values in the vector.

My question is:

This hashmap, has to be put into a jtable,such that if the key has single value, put it to text box. If it has multiple values insert a combobox in the row of that table.

I need the swing code for this problem

Answers


Not code but steps that can help you..

  1. Create a Table.
  2. Every time adding a new row check for the hashmap value and if it is a single value add textbox to that cell or add comboBox.
  3. Repeat step 2 for all hashmap keys.

References that can help you:-

  1. Adding row in table
  2. Adding comboBox in table
  3. JTable add/remove rows to custom table model (updating table display)

Need Your Help

Redirects and Referers

php redirect http-referer

My actual implementation of this is much more complicated, with authentication and a bunch of other stuff, but at the simplest form, here's the problem I'm having. Redirecting with header doesn't r...

need help from a CSS wiz - create a table “look” without using a table

css list table html

I'm trying to create a page which looks somewhat like this: