• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTable usage

 
Chinmay Bajikar
Ranch Hand
Posts: 159
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am trying to build a quick and dirty kind of JTable UI, which will allow you to define relations between columns of 2 tables.
So the table has 4 columns.1st one being names of the source tables in a ComboBox,2nd one should have the columns of the table selected in the 1st col (in a combobox).Same goes for the 3rd and 4th columns which will hold the table names and col names for the target tables.

I am having problems updating the 2nd col based on the selection done in the 1st.
Any ideas from anybody who has done something similar??

Thanks,
Chinmay
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is your approach?
 
prasanna kanth
Greenhorn
Posts: 28
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, can you explain clearly,
 
prasanna kanth
Greenhorn
Posts: 28
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, can you explain clearly,

Prasanna
 
Chinmay Bajikar
Ranch Hand
Posts: 159
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have extended the AbstractCellEditor to have my own CellEditor.
In the
public Component getTableCellEditorComponent(JTable table,Object value,boolean isSelected,int row,int col)
Every time the col tht is clicked is the one which represents the table-columns, I get the table name from the adjoining column and populate the combo with all the columns for tht table.

I am pasting the code here,
Even numbered cols are the ones for Table-Columns and odd numbered are the Table Names.
Hope it makes things clearer.


 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic