I've got some code which attemps to display a JPanel within a JTable cell, but instead the output from a JPanel.toString() appears there instead. Any ideas as to what could be wrong?
Thanks,
Chris.
Printable View
I've got some code which attemps to display a JPanel within a JTable cell, but instead the output from a JPanel.toString() appears there instead. Any ideas as to what could be wrong?
Thanks,
Chris.
Forget it.
I was trying to follow Java 2 examples using Java 1.1.6.
It didn't quite work. ;)
Chris
The default JTable renderer (Class based rendering) handles String, boolean and numbers.
Typically one needs to do the following
1) Create your class implementing TableCellRenderer interface and extending from any JComponent subclass (In your case extends JPanel)
2) Set the instance of the this class to the appropiate column.
e.g., <table_name>.getColumnModel().getColumn(0).setCellRenderer(<your_class>);
This should do the job.
Thanks