This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

File listing using swings....

 
remi vandana
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
pl. help me out in acheiving the foll:
U all must hv seen tht while using std Word or any Microsoft prod, When we clk on File menu we get the listing of recently opened files before "exit" menu item.
whtevr file r opened or closed it appears in the list.
Same file list also appears whn we clk on "window" menu item. but the no.of file here are just 3 most recent files whereas whn ths appears on "File" menulist thn the no.of most recently opened files are 8.
i also want to implement this in my GUI.
i hv made Menu using JMenu, Jmenuitems etc.
I want same std word file listing implementation here too...
pl. reply soon....
 
Ben Wood
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi remi,
I have been thinking about this too for one of my applications, but haven't actually done it yet.
The way I'm going to approach this is
1) When you open a file you will need to add it's path and name to some text file which always holds, say, 8 filenames in a list (files separated by new lines). If there are already 8 files in the list, remove the first one and add the new one to the end.
2) Use this file when you are creating your swing JMenu. First, read the text file list into an array of Strings with 8 elements. Then, use the values of these array elements in a loop to generate new JMenuItems, soemthing like the following:
e.g.

If you make any progress with this, I would be interested to know how you do it.
hope this is of some use.
Ben.
[This message has been edited by Ben Wood (edited August 29, 2001).]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic