473,404 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Pagination in jtable

14
I want to do paging concept in my jtable by displaying 10 records per page if i choose 25 in rowcount, it has to split 10 in each page balance records in last page using previous and next buttons. Also After complete filling the 10 records and going to next page and fill the balance records. If i give back button the information which i gave should display.. Pls guide me in doing this task.
Aug 22 '08 #1
5 10086
Nepomuk
3,112 Expert 2GB
What have you done so far? In what format are those records stored? And can you give an example for the records and the output, so that it will be easier to understand? (Maybe just display 3 records per page in the example, to simplify things...)

Greetings,
Nepomuk
Aug 22 '08 #2
saiindu
14
According to the row count records r splitted to 10 per page. That is if i give 12 records in rowcount.It'll show 10 records in one page and 2 records in second page. Records in jtable r saved in arraylist and using tokenizer we r retrieving the records. And i've used the below code to split the records as 10 per page.
This is called in the Next button click event
Expand|Select|Wrap|Line Numbers
  1. private void Assign_Page2(int RowCount) {
  2.         System.out.println("4");
  3.         if (Page == 1) {
  4.             System.out.println("5");
  5.             Page = (RowCount / Count) + 1;            
  6.         } else {
  7.             System.out.println("6");
  8.             Page --;
  9.         }
  10.         if (Page * Count <= RowCount) {
  11.             System.out.println("7");
  12.             int start = ((Page - 1) * Count) + 1;
  13.             int end = Page * Count;
  14.             Tableshow(start, end);
  15.         } else {
  16.             System.out.println("8");
  17.             int start = ((Page - 1) * Count) + 1;
  18.             int end = RowCount;
  19.             Tableshow(start, end);
  20.         }
  21.     }
  22.  
Now i want to store and retrieve the values i give in each page using arraylist tokenizer. If i give back button the values which i gave in page 1 or page 2 should display. So kindly help
Aug 28 '08 #3
BigDaddyLH
1,216 Expert 1GB
Try your favourite Internet search engine. It's not hard, just choose a few keywords like :"JTable" and "Paging". Here is an example:

http://www.google.ca/search?hl=en&q=JTable+Paging

Now look at the hits you get. The very first is an article entitled "Paging in a Swing JTable".

This fantastic technique (searching the Internet) is great for not only answering Java questions, or other programming puzzles, but for just about anything. Try it, and let your friends know about it, too!
Aug 28 '08 #4
saiindu
14
All i need is not given in that article given in that site. I want to save and retrieve the values whever i need in that paging without database. I already stored that using arraylist but i dont know how to print in required page.
Aug 29 '08 #5
saiindu
14
I need some samples which is by using previous and next pages and the records every page can be stored and viewed using Arraylist..
Aug 29 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Ben Munday | last post by:
Hi all, I have a problem with a Checkbox in a JTable. When i add the Checkbox into the JTable it displays the String representation of the Checkbox, which is not what i want. So, i created a...
1
by: asd | last post by:
I need to make the cells in the 1st column look like the column header. I tried the following code but it didn't change anything: private void rendererTest() { TableColumn column =...
1
by: raysaun | last post by:
I am trying to set a TableCellEditor for a JTable, however, the editor never seems to get called. I can not even get a simplified version (below) to work. When I put a breakpoint on the return...
0
by: sivaprasad06 | last post by:
Hi, I have a editable combo box editor as a cell editor for JTable. I want use only key board to enter data into jtable. so i am using ALT+Down comobination for making cell editiable in the...
0
by: nuria | last post by:
hi, I have an editable JTable, when you are editing it and press F8 shows a dialog and then go again to the JTable window but the focus goes to a JtextField component, go with the tab for the...
1
by: Andrea Sansottera | last post by:
Hi fellows, I was wondering if in the Java API there's a way to easily map a disconnected RowSet to a JTable... I have looked at the doc but i did not found anything. What I want is simply do...
1
by: onsir | last post by:
I have code like this, but still wrong. how to show data from database in JTable. package my.JavaNetBean; import java.sql.*; import java.io.*; import java.sql.Connection; import...
7
blazedaces
by: blazedaces | last post by:
Hi guys, what I'm I have is a jtable with boolean variables in the first column and text in the next two (checkboxes). I want my tableChanged method to make it so when I check one of the checkboxes...
5
by: moizpalitanawala | last post by:
Hello friends, How to add data to JTable from a .txt file. I had seen this code from one of the tutorial from java.com. This code doesnt take any input. But shows what is written in the array....
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.