DropDown in cell of jTable  
Author Message
_Mario_





PostPosted: 2004-9-28 17:36:00 Top

java-programmer, DropDown in cell of jTable Hi all,

I wish to put a drop down where to choose from when the user edit a certai
cell of a jTable.
The drop down should appear in the position of the cell thas is going to be
edited....

Is it possible? How?

can someone point me in the right direction? (or send a snippet of code ;) )


Thanks.

Mario



 
IchBin





PostPosted: 2004-9-28 18:09:00 Top

java-programmer >> DropDown in cell of jTable _Mario_ wrote:
> Hi all,
>
> I wish to put a drop down where to choose from when the user edit a certai
> cell of a jTable.
> The drop down should appear in the position of the cell thas is going to be
> edited....
>
> Is it possible? How?
>
> can someone point me in the right direction? (or send a snippet of code ;) )
>
>
> Thanks.
>
> Mario
>
>
>
Sure.

Look at *your* installed JSDK directory for the *jTable examples*:

\Java\j2sdk(What ever version)\demo\plugin\jfc\TableExample\src

They have code that demonstrates this.
--


Hope this helps...
IchBin
__________________________________________________________________________

'Laughter is inner jogging'
- Norman Cousins, editor and author (1915-1990)
 
Dag Sunde





PostPosted: 2004-9-28 21:07:00 Top

java-programmer >> DropDown in cell of jTable "_Mario_" <email***@***.com> wrote in message
news:email***@***.com...
> Hi all,
>
> I wish to put a drop down where to choose from when the user edit a certai
> cell of a jTable.
> The drop down should appear in the position of the cell thas is going to
be
> edited....
>
> Is it possible? How?
>
> can someone point me in the right direction? (or send a snippet of code
;) )
>
>

...
TableColumn myColumn = myTable.getColumnModel().getColumn(YOUR_COL_NUMBER);
JComboBox comboEditor = new JComboBox();
comboEditor.addItem("Item 1");
comboEditor.addItem("Item 2");
comboEditor.addItem("Item 3");
myColumn.setCellEditor(new DefaultCellEditor(comboEditor));
...

--
Dag
58?6'15.9" N 008?6'45.5" E


 
 
_Mario_





PostPosted: 2004-9-28 22:50:00 Top

java-programmer >> DropDown in cell of jTable
Thanks for all your answer!

Mario