This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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
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