/** Populate recent bookmarks. */ public void populateRecentBookmarks() { JMenu bookmarksMenu = this.recentBookmarksMenu; bookmarksMenu.removeAll(); Collection<HistoryEntry<BookmarkInfo>> historyEntries = BookmarksHistory.getInstance().getRecentEntries(PREFERRED_MAX_MENU_SIZE); for (HistoryEntry<BookmarkInfo> hentry : historyEntries) { BookmarkInfo binfo = hentry.getItemInfo(); String text = binfo.getTitle(); URL url = binfo.getUrl(); String urlText = url.toExternalForm(); if ((text == null) || (text.length() == 0)) { text = urlText; } long elapsed = System.currentTimeMillis() - hentry.getTimetstamp(); text = text + " (" + Timing.getElapsedText(elapsed) + " ago)"; Action action = this.actionPool.createBookmarkNavigateAction(url); JMenuItem menuItem = ComponentSource.menuItem(text, action); StringBuffer toolTipText = new StringBuffer(); toolTipText.append("<html>"); toolTipText.append(urlText); String description = binfo.getDescription(); if ((description != null) && (description.length() != 0)) { toolTipText.append("<br>"); toolTipText.append(description); } menuItem.setToolTipText(toolTipText.toString()); bookmarksMenu.add(menuItem); } }