如何在jtable中自动换行?

问题描述 投票:0回答:1

嗨,我正在使用Java JTable

 dff[i] = new DefaultTableModel(
                        new Object[][] {
                            {"ID",tab[i].get("id")},
                            {"Titre",tab[i].get("title")},
                            {"Auteur",tab[i].get("authors")},
                            {"Date",tab[i].get("date")},
                            {"Resume","Substitution ciphers are codes in which each letter of the alphabet has one fixed substitute, and the word divisions do not change.."},
                        },
                        new String[] {
                            "New column",""
                        }
                    );

             jj[i]= new JTable(dff[I]); 

但是我得到

https://i.stack.imgur.com/sCuNn.png

如果可能,我想在抽象部分中添加自动换行

java swing jtable line-breaks
1个回答
0
投票

非常感谢camickr🥰我添加了<HTML> <p>及其工作

tab[i].get("abstract")="Substitution ciphers are codes in which each letter of the alphabet has one fixed substitute, and the word divisions do not change.";

{"Resume","<html><p>"+tab[i].get("abstract")+"</p></html>"}
© www.soinside.com 2019 - 2024. All rights reserved.