ivanthepro
asked on
JTable cell wrap
Does anyone knows how to wrap text in a Jtable cell?
Thanks
Ivan
Thanks
Ivan
Are you using you own CellRenderer??
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ive got no idea, im new to this...
pls help from the beginning pls
pls help from the beginning pls
>>>> " wrap text in jtable cell"... do you want to customize the appearance of the text?
ASKER
i only want some multiline and justified alignment.
thanks
thanks
ASKER
someone give me some basic codes pls
1. Write a java file say cellWrapText.java which extends JPanel.On the JPanel add a TextArea with scroll pane.
2. Write a java file say cellEditorText.java which extends TableCellEditor. create an instance of CellWrapText and in the getTableCellEditorComponen t method of cellEditorText.java set the text to the text area.
3.Write a java file for render which extends JTextArea implements TableCellRenderer.
4. Finally in the main file where u are creating the JTable
a) get the column for which you want to wrap the text.
TableColumn column = columnmodel.getColumn(colu mnNumber);
column.setCellEditor(insta nce of CellEditorText u have created);
column.setCellRenderer(ins tance of cell renderer u have created and pass the JTable to it);
2. Write a java file say cellEditorText.java which extends TableCellEditor. create an instance of CellWrapText and in the getTableCellEditorComponen
3.Write a java file for render which extends JTextArea implements TableCellRenderer.
4. Finally in the main file where u are creating the JTable
a) get the column for which you want to wrap the text.
TableColumn column = columnmodel.getColumn(colu
column.setCellEditor(insta
column.setCellRenderer(ins
ivanthepro:
This old question needs to be finalized -- accept an answer, split points, or get a refund. For information on your options, please click here-> http:/help/closing.jsp#1
EXPERTS:
Post your closing recommendations! No comment means you don't care.
This old question needs to be finalized -- accept an answer, split points, or get a refund. For information on your options, please click here-> http:/help/closing.jsp#1
EXPERTS:
Post your closing recommendations! No comment means you don't care.
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
- Points for bapi
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
Venabili
EE Cleanup Volunteer
I will leave a recommendation in the Cleanup topic area that this question is:
- Points for bapi
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
Venabili
EE Cleanup Volunteer