将很长的jtable打印成多页



我有一个很长的j表,使用实体到数据库创建,其中有2000多条记录,我想使用java代码将该表打印成多个页面,根据需要划分。。需要帮助或代码来实现此

根据我从你的问题中了解到的情况,你希望在为一些JPanel创建一组对象或为它们创建某种其他存储时使用一些计数器,例如在以下代码中:

int i = 0; //Use this to count the number of entries already placed int counter = n; //A second counter to count the number you want displayed per page (n) while(i<2000){ //Here, code for creating a container for the next n set of items can be placed while(i<counter){ //Here is where you put however you wish to create and display your items i++; //Progressing the counter for database entries } counter = counter+n; //Progressing the counter for how many you want per page }

这应该适用于将您的条目处理成数组或某种数据结构的格式,这将允许您使用计数器在其中导航,希望这对有所帮助

最新更新