File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes My Query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "My Query " Watch "My Query " New topic

My Query

Bharati GM

Joined: Jun 25, 2001
Posts: 2
Hello Sir,
I am developing an Appliction using Java swings(JFRAME,JPanel other components) In that I am Using two JButtons(For BACK and FORWORD).If I click On BACK button I need to get the Previous Frame Content and If Click on FORWORD JButton I need to get updated Contents.
I've tried with UNDO() Package but then also I did not the Required output.Help me to get these Functions.
Thanks in Advance,
Amit Agarwal
Ranch Hand

Joined: May 09, 2001
Posts: 92
Hi Bharati,
It depends on the situation whether you are interested in changing the components of the frame or whether you want to change the data in the components on the fram.
For changing the components you may use the Card layout and show a card at a time and use the back and forward buttons to go thru the cards.
For changing the data. Define a class that can hold all data to be displayed on the form. Use a vector or a linkedlist to store instances of the data objects. maintain an index (int) to keep track of where you are in the data list. when you press the back button, decrement the index by 1 and display the data of corresponding object from the vector. when you press the forward button increment the index by 1. you will have to check for the extreme cases that is beginning of list and end of list.
I agree. Here's the link:
subject: My Query
It's not a secret anymore!