Package jam.framework
Class RecentFileList
java.lang.Object
jam.framework.RecentFileList
- All Implemented Interfaces:
ActionListener,EventListener
A class for maintaining a "Recent File List".
The recent file list can be stored between program invocations in
a properties file. One or more RecentFileLists can easily
be embedded in a JMenu.
- Version:
- $Id: RecentFileList.java 183 2006-01-23 21:29:48Z rambaut $
- Author:
- Tony Johnson (tonyj@slac.stanford.edu)
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a RecentFileListRecentFileList(int size) Create a RecentFileList with a given maximum lengthRecentFileList(String type) Create a recent file list.RecentFileList(String type, int size) Create a recent file list with a given type and size -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidAdd a file to the listvoidAdd a file to the listvoidvoidAdds the recent file list to a menu.voidload(Properties props) Load the recent file list from a Properties setvoidRemove a file from the listvoidRemove a file from the listvoidvoidsave(Properties props) Save the recent file list in a Properties set
-
Constructor Details
-
RecentFileList
public RecentFileList()Create a RecentFileList -
RecentFileList
public RecentFileList(int size) Create a RecentFileList with a given maximum length- Parameters:
size- the maximum number of files to remember
-
RecentFileList
Create a recent file list. The type parameter is used to prefix entries in the properties file, so that multiple RecentFileLists can be used in an application.- Parameters:
type- The prefix to use
-
RecentFileList
Create a recent file list with a given type and size- Parameters:
type- The prefix to usesize- the maximum number of files to remember
-
-
Method Details
-
addActionListener
-
removeActionListener
-
actionPerformed
- Specified by:
actionPerformedin interfaceActionListener
-
save
Save the recent file list in a Properties set- Parameters:
props- The Properties set to save the files in
-
load
Load the recent file list from a Properties set- Parameters:
props- The Properties set to load from
-
add
Add a file to the list- Parameters:
f- The file to add
-
remove
Remove a file from the list- Parameters:
f- Remove a file from the list
-
add
Add a file to the list- Parameters:
name- The name of the file to add
-
remove
Remove a file from the list- Parameters:
name- The name of the file to remove
-
buildMenu
Adds the recent file list to a menu. The files will be added at the end of the menu, with a separator before the files (if there are >0 files in the list)
-