📄 bookmarklist.java~
字号:
import java.io.*;// class to handle a list of bookmarkspublic class BookmarkList { private EmptyBookmarks list; // the list of bookmarks public BookmarkList( ){ list = new EmptyBookmarks(); } // return the number of bookmarks in the list public int size( ){ return list.getSize(); } // return the bookmark at index public Bookmark getSelectedItem( int index ){ return list.getSelectedItem( size() - (index + 1) ); } // add a bookmark to the list public void add( Bookmark entry ){ list = list.add(entry); } // Print all bookmark entries public void printBookmarks() { for ( int i = 0; i < size(); i++) { System.out.println( getSelectedItem(i).toString() ); } } // Place all bookmark entries in bookmarks.html public void saveBookmarksFile() { try { FileWriter bookmarksFile = new FileWriter("bookmarks.html"); for ( int i = 0; i < size(); i++) { bookmarksFile.write( getSelectedItem(i).toString()); } bookmarksFile.close(); } catch ( IOException e) { System.out.println("Unable to access bookmarks file - " + e.getMessage()); } } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -