Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

My Query

 
Bharati GM
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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,
Bharati
 
Amit Agarwal
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
----------
Amit
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic