H
Happy Day
Hi Guys,
I've tried to integrate the JScrollPane to the one the the cell in the
JTable.
These are my code I've tried.
==================================================================
TableColumnModel tcm = table.getColumnModel();
TableColumn destinationColumn;
..
..
..
..
JScrollPane listScrollPane;
listModel = new DefaultListModel();
listModel.addElement("any");
listModel.addElement("1st");
listModel.addElement("dummy1");
listModel.addElement("dummy2");
listModel.addElement("dummy3");
listModel.addElement("dummy4");
list = new JList(listModel);
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
list.setSelectedIndex(0);
list.addListSelectionListener(this);
list.setVisibleRowCount(5);
listScrollPane = new JScrollPane(list);
destinationColumn.setCellEditor(new DefaultCellEditor(listScrollPane));
// ?????????????????????
==================================================================
As shown, I created JList and put it in the JScrollPane. Then, I like
to put the JScrollPane into the cell in the JTable.
I know the last line has the syntax error because the
"DefaultCellEditor" cannot have the scrollPane type.
How can I solve the problem??
Thank you in advance.
I've tried to integrate the JScrollPane to the one the the cell in the
JTable.
These are my code I've tried.
==================================================================
TableColumnModel tcm = table.getColumnModel();
TableColumn destinationColumn;
..
..
..
..
JScrollPane listScrollPane;
listModel = new DefaultListModel();
listModel.addElement("any");
listModel.addElement("1st");
listModel.addElement("dummy1");
listModel.addElement("dummy2");
listModel.addElement("dummy3");
listModel.addElement("dummy4");
list = new JList(listModel);
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
list.setSelectedIndex(0);
list.addListSelectionListener(this);
list.setVisibleRowCount(5);
listScrollPane = new JScrollPane(list);
destinationColumn.setCellEditor(new DefaultCellEditor(listScrollPane));
// ?????????????????????
==================================================================
As shown, I created JList and put it in the JScrollPane. Then, I like
to put the JScrollPane into the cell in the JTable.
I know the last line has the syntax error because the
"DefaultCellEditor" cannot have the scrollPane type.
How can I solve the problem??
Thank you in advance.