Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

How to update randomaccessfile  RSS feed

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm studying Java,

I wrote a Address book for practice.
Actually I follow a sample and finally finish. It work fine. It has Add new, Move Next, Move Last, Move First, Clear Buttons. I need to add UPDATE Button. I already Add that button. How can I do the coding?

I don't know how to play with " seek(position)"

Can anybody give some Example code please?


 
Marshal
Posts: 60113
188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You ought to separate the logic ("M" for Model) from the class which displays the GUI ("V" for view). I would suggest you have a File object which contains data corresponding to Address objects. Then you can find an Address object, and a way to write it into the file. You would need to find a particular Address object before trying to update it.

Move the clear instructions out of the clear button actionPerformed method into a clearDisplay() method and call clearDisplay() from the actionPerformed method.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!