java - Add multiple editor in one cell -
i created jcombobox in column , works fine. problem occurs when tried add 1 more editor in same column. scenario, user need choose value combobox remark. if choose others, textbox should appear below combobox user type.
code combobox
tablecolumn col5 = jtable1.getcolumnmodel().getcolumn(4); string[] options = new string[]{"font issue","text issue","image issue","ai issue","others"}; jcombobox combo1 = new jcombobox(options); jcombobox combo2 = new jcombobox(options); col5.setcelleditor(new defaultcelleditor(combo1)); col5.setcellrenderer(new comboboxrenderer(combo2)); combo2.addactionlistener(new actionlistener() { public void actionperformed(actionevent e) { jcombobox namecombo = (jcombobox)e.getsource(); string newselection = (string)namecombo.getselecteditem(); if(newselection.equalsignorecase("others")) { } } }); when add 1 more editor.
mytablecelleditor texteditor = new mytablecelleditor (); col5.setcelleditor(texteditor );
it overwrite dropdownlist. want have this.

swing editors designed occupy space of single cell. if want display panel 2 components need create popup editor. read section swing tutorial on using other editors example of how might this.
Comments
Post a Comment