How to wrap lines in a jtable cell?

前端 未结 8 1028
面向向阳花
面向向阳花 2020-11-29 09:11

I\'m trying to implement a custom TableRenderer as described in this tutorial. I\'d like to have the renderer line-wrap each text that is to long for the given cell. The i

8条回答
  •  無奈伤痛
    2020-11-29 09:39

    Write the headers in HTML. Here is an example of one that I have. The only issue that I am experiencing is I am having a hard time having them scroll in the JPanel if I adjust the height of the headers.

        myTable.getColumnModel().getColumn(1).setPreferredWidth(75);
        myTable.getColumnModel().getColumn(1).setHeaderValue("Day Of
    Week
    ");

提交回复
热议问题