g.dispose();
return new ImageIcon(image);
}
private JMenuBar initMenuBar() {
final JMenuBar menuBar = new JMenuBar();
fileMenu = new JMenu(LocalisationHelper.getString("main_frame_menu_file"));
fileMenu.setMnemonic(LocalisationHelper.getString("main_frame_menu_mnemonic_file").charAt(0));
menuBar.add(fileMenu);
JMenuItem menuItem = new JMenuItem(openFileAction);
fileMenu.add(menuItem);
menuItem = new JMenuItem(openURLAction);
fileMenu.add(menuItem);
recentURLsMenu.setIcon(createEmptyImageIcon(20, 20));
fileMenu.add(recentURLsMenu);
exportMenuItem = new JMenuItem(exportAction);
fileMenu.add(exportMenuItem);
menuItem = new JMenuItem(refreshAction);
fileMenu.add(menuItem);
menuItemWatch = new JCheckBoxMenuItem(watchAction);
fileMenu.add(menuItemWatch);
if ( ! OSXSupport.isOSX()) {
menuItem = new JMenuItem(exitAction);
fileMenu.add(menuItem);
}
final JMenu viewMenu = new JMenu(LocalisationHelper.getString("main_frame_menu_view"));
viewMenu.setMnemonic(LocalisationHelper.getString("main_frame_menu_mnemonic_view").charAt(0));
menuBar.add(viewMenu);
gcLineMenuItems = new HashMap<String, JCheckBoxMenuItem>();
menuItemShowDataPanel = new JCheckBoxMenuItem(LocalisationHelper.getString("main_frame_menuitem_show_data_panel"), true);
menuItemShowDataPanel.setMnemonic(LocalisationHelper.getString("main_frame_menuitem_mnemonic_show_data_panel").charAt(0));
menuItemShowDataPanel.setIcon(createEmptyImageIcon(20, 20));
menuItemShowDataPanel.setToolTipText(LocalisationHelper.getString("main_frame_menuitem_hint_show_data_panel"));
menuItemShowDataPanel.setActionCommand(GCPreferences.SHOW_DATA_PANEL);
menuItemShowDataPanel.addActionListener(new ActionListener(){
public void actionPerformed(final ActionEvent e) {
final GCDocument gcDocument = getSelectedGCDocument();
if (gcDocument != null) {
gcDocument.setShowModelPanel(menuItemShowDataPanel.getState());
}
}
});
viewMenu.add(menuItemShowDataPanel);
viewMenu.addSeparator();
gcLineMenuItems.put(GCPreferences.SHOW_DATA_PANEL, menuItemShowDataPanel);
menuItemShowDateStamp = new JCheckBoxMenuItem(LocalisationHelper.getString("main_frame_menuitem_show_data_panel"), true);
menuItemShowDateStamp.setMnemonic(LocalisationHelper.getString("main_frame_menuitem_mnemonic_show_data_panel").charAt(0));
menuItemShowDateStamp.setIcon(createEmptyImageIcon(20, 20));
menuItemShowDateStamp.setToolTipText(LocalisationHelper.getString("main_frame_menuitem_hint_show_data_panel"));
menuItemShowDateStamp.setActionCommand(GCPreferences.SHOW_DATE_STAMP);
menuItemShowDateStamp.addActionListener(new ActionListener(){
public void actionPerformed(final ActionEvent e) {
final GCDocument gcDocument = getSelectedGCDocument();
if (gcDocument != null) {
gcDocument.setShowModelPanel(menuItemShowDateStamp.getState());
}
}
});
// TODO fix menu item "showdatestamp"
//viewMenu.add(menuItemShowDateStamp);
//viewMenu.addSeparator();
gcLineMenuItems.put(GCPreferences.SHOW_DATE_STAMP, menuItemShowDateStamp);
menuItemAntiAlias = new JCheckBoxMenuItem(LocalisationHelper.getString("main_frame_menuitem_antialias"), true);
menuItemAntiAlias.setMnemonic(LocalisationHelper.getString("main_frame_menuitem_mnemonic_antialias").charAt(0));
menuItemAntiAlias.setIcon(createEmptyImageIcon(20, 20));
menuItemAntiAlias.setToolTipText(LocalisationHelper.getString("main_frame_menuitem_hint_antialias"));
menuItemAntiAlias.setActionCommand(GCPreferences.ANTI_ALIAS);
menuItemAntiAlias.addActionListener(new ActionListener(){
public void actionPerformed(final ActionEvent e) {
final GCDocument gcDocument = getSelectedGCDocument();
if (gcDocument != null) {
gcDocument.getModelChart().setAntiAlias(menuItemAntiAlias.getState());
gcDocument.relayout();
}
}
});
menuItemAntiAlias.setSelected(false);
viewMenu.add(menuItemAntiAlias);
viewMenu.addSeparator();
gcLineMenuItems.put(GCPreferences.ANTI_ALIAS, menuItemAntiAlias);
menuItemFullGCLines = new JCheckBoxMenuItem(LocalisationHelper.getString("main_frame_menuitem_full_gc_lines"), true);
menuItemFullGCLines.setMnemonic(LocalisationHelper.getString("main_frame_menuitem_mnemonic_full_gc_lines").charAt(0));
menuItemFullGCLines.setToolTipText(LocalisationHelper.getString("main_frame_menuitem_hint_full_gc_lines"));
menuItemFullGCLines.setIcon(createMonoColoredImageIcon(FullGCLineRenderer.DEFAULT_LINEPAINT, 20, 20));
menuItemFullGCLines.setActionCommand(GCPreferences.FULL_GC_LINES);
menuItemFullGCLines.addActionListener(viewMenuActionListener);
viewMenu.add(menuItemFullGCLines);
gcLineMenuItems.put(GCPreferences.FULL_GC_LINES, menuItemFullGCLines);
menuItemIncGCLines = new JCheckBoxMenuItem(LocalisationHelper.getString("main_frame_menuitem_inc_gc_lines"), true);
menuItemIncGCLines.setMnemonic(LocalisationHelper.getString("main_frame_menuitem_mnemonic_inc_gc_lines").charAt(0));
menuItemIncGCLines.setToolTipText(LocalisationHelper.getString("main_frame_menuitem_hint_inc_gc_lines"));
menuItemIncGCLines.setIcon(createMonoColoredImageIcon(IncLineRenderer.DEFAULT_LINEPAINT, 20, 20));
menuItemIncGCLines.setActionCommand(GCPreferences.INC_GC_LINES);
menuItemIncGCLines.addActionListener(viewMenuActionListener);
viewMenu.add(menuItemIncGCLines);
gcLineMenuItems.put(GCPreferences.INC_GC_LINES, menuItemIncGCLines);
menuItemGcTimesLine = new JCheckBoxMenuItem(LocalisationHelper.getString("main_frame_menuitem_gc_times_line"), true);
menuItemGcTimesLine.setMnemonic(LocalisationHelper.getString("main_frame_menuitem_mnemonic_gc_times_line").charAt(0));
menuItemGcTimesLine.setToolTipText(LocalisationHelper.getString("main_frame_menuitem_hint_gc_times_line"));
menuItemGcTimesLine.setIcon(createMonoColoredImageIcon(GCTimesRenderer.DEFAULT_LINEPAINT, 20, 20));
menuItemGcTimesLine.setActionCommand(GCPreferences.GC_LINES_LINE);
menuItemGcTimesLine.addActionListener(viewMenuActionListener);
viewMenu.add(menuItemGcTimesLine);
gcLineMenuItems.put(GCPreferences.GC_LINES_LINE, menuItemGcTimesLine);
menuItemGcTimesRectangle = new JCheckBoxMenuItem(LocalisationHelper.getString("main_frame_menuitem_gc_times_rectangles"), true);
menuItemGcTimesRectangle.setMnemonic(LocalisationHelper.getString("main_frame_menuitem_mnemonic_gc_times_rectangles").charAt(0));
menuItemGcTimesRectangle.setToolTipText(LocalisationHelper.getString("main_frame_menuitem_hint_gc_times_rectangles"));
menuItemGcTimesRectangle.setIcon(createMonoColoredImageIcon(GCRectanglesRenderer.DEFAULT_LINEPAINT, 20, 20));
menuItemGcTimesRectangle.setActionCommand(GCPreferences.GC_TIMES_RECTANGLES);
menuItemGcTimesRectangle.addActionListener(viewMenuActionListener);
viewMenu.add(menuItemGcTimesRectangle);
gcLineMenuItems.put(GCPreferences.GC_TIMES_RECTANGLES, menuItemGcTimesRectangle);
menuItemTotalMemory = new JCheckBoxMenuItem(LocalisationHelper.getString("main_frame_menuitem_total_memory"), true);
menuItemTotalMemory.setMnemonic(LocalisationHelper.getString("main_frame_menuitem_mnemonic_total_memory").charAt(0));
menuItemTotalMemory.setToolTipText(LocalisationHelper.getString("main_frame_menuitem_hint_total_memory"));
menuItemTotalMemory.setIcon(createMonoColoredImageIcon(TotalHeapRenderer.DEFAULT_LINEPAINT, 20, 20));
menuItemTotalMemory.setActionCommand(GCPreferences.TOTAL_MEMORY);
menuItemTotalMemory.addActionListener(viewMenuActionListener);
viewMenu.add(menuItemTotalMemory);
gcLineMenuItems.put(GCPreferences.TOTAL_MEMORY, menuItemTotalMemory);
menuItemTenuredMemory = new JCheckBoxMenuItem(LocalisationHelper.getString("main_frame_menuitem_tenured_memory"), true);
menuItemTenuredMemory.setMnemonic(LocalisationHelper.getString("main_frame_menuitem_mnemonic_tenured_memory").charAt(0));
menuItemTenuredMemory.setToolTipText(LocalisationHelper.getString("main_frame_menuitem_hint_tenured_memory"));
menuItemTenuredMemory.setIcon(createMonoColoredImageIcon(TotalTenuredRenderer.DEFAULT_LINEPAINT, 20, 20));
menuItemTenuredMemory.setActionCommand(GCPreferences.TENURED_MEMORY);
menuItemTenuredMemory.addActionListener(viewMenuActionListener);
viewMenu.add(menuItemTenuredMemory);
gcLineMenuItems.put(GCPreferences.TENURED_MEMORY, menuItemTenuredMemory);
menuItemYoungMemory = new JCheckBoxMenuItem(LocalisationHelper.getString("main_frame_menuitem_young_memory"), true);
menuItemYoungMemory.setMnemonic(LocalisationHelper.getString("main_frame_menuitem_mnemonic_young_memory").charAt(0));
menuItemYoungMemory.setToolTipText(LocalisationHelper.getString("main_frame_menuitem_hint_young_memory"));
menuItemYoungMemory.setIcon(createMonoColoredImageIcon(TotalYoungRenderer.DEFAULT_LINEPAINT, 20, 20));
menuItemYoungMemory.setActionCommand(GCPreferences.YOUNG_MEMORY);
menuItemYoungMemory.addActionListener(viewMenuActionListener);
viewMenu.add(menuItemYoungMemory);
gcLineMenuItems.put(GCPreferences.YOUNG_MEMORY, menuItemYoungMemory);
menuItemUsedMemory = new JCheckBoxMenuItem(LocalisationHelper.getString("main_frame_menuitem_used_memory"), true);
menuItemUsedMemory.setMnemonic(LocalisationHelper.getString("main_frame_menuitem_mnemonic_used_memory").charAt(0));
menuItemUsedMemory.setToolTipText(LocalisationHelper.getString("main_frame_menuitem_hint_used_memory"));
menuItemUsedMemory.setIcon(createMonoColoredImageIcon(UsedHeapRenderer.DEFAULT_LINEPAINT, 20, 20));
menuItemUsedMemory.setActionCommand(GCPreferences.USED_MEMORY);
menuItemUsedMemory.addActionListener(viewMenuActionListener);
viewMenu.add(menuItemUsedMemory);
gcLineMenuItems.put(GCPreferences.USED_MEMORY, menuItemUsedMemory);
menuItemUsedTenuredMemory = new JCheckBoxMenuItem(LocalisationHelper.getString("main_frame_menuitem_used_tenured_memory"), true);
menuItemUsedTenuredMemory.setMnemonic(LocalisationHelper.getString("main_frame_menuitem_mnemonic_used_tenured_memory").charAt(0));
menuItemUsedTenuredMemory.setToolTipText(LocalisationHelper.getString("main_frame_menuitem_hint_used_tenured_memory"));
menuItemUsedTenuredMemory.setIcon(createMonoColoredImageIcon(UsedTenuredRenderer.DEFAULT_LINEPAINT, 20, 20));
menuItemUsedTenuredMemory.setActionCommand(GCPreferences.USED_TENURED_MEMORY);
menuItemUsedTenuredMemory.addActionListener(viewMenuActionListener);
viewMenu.add(menuItemUsedTenuredMemory);
gcLineMenuItems.put(GCPreferences.USED_TENURED_MEMORY, menuItemUsedTenuredMemory);
menuItemUsedYoungMemory = new JCheckBoxMenuItem(LocalisationHelper.getString("main_frame_menuitem_used_young_memory"), true);
menuItemUsedYoungMemory.setMnemonic(LocalisationHelper.getString("main_frame_menuitem_mnemonic_used_young_memory").charAt(0));
menuItemUsedYoungMemory.setToolTipText(LocalisationHelper.getString("main_frame_menuitem_hint_used_young_memory"));
menuItemUsedYoungMemory.setIcon(createMonoColoredImageIcon(UsedYoungRenderer.DEFAULT_LINEPAINT, 20, 20));
menuItemUsedYoungMemory.setActionCommand(GCPreferences.USED_YOUNG_MEMORY);
menuItemUsedYoungMemory.addActionListener(viewMenuActionListener);
viewMenu.add(menuItemUsedYoungMemory);
gcLineMenuItems.put(GCPreferences.USED_YOUNG_MEMORY, menuItemUsedYoungMemory);
menuItemInitialMarkLevel = new JCheckBoxMenuItem(LocalisationHelper.getString("main_frame_menuitem_initial_mark_level"), true);
menuItemInitialMarkLevel.setMnemonic(LocalisationHelper.getString("main_frame_menuitem_mnemonic_initial_mark_level").charAt(0));
menuItemInitialMarkLevel.setToolTipText(LocalisationHelper.getString("main_frame_menuitem_hint_initial_mark_level"));
menuItemInitialMarkLevel.setIcon(createMonoColoredImageIcon(InitialMarkLevelRenderer.DEFAULT_LINEPAINT, 20, 20));
menuItemInitialMarkLevel.setActionCommand(GCPreferences.INITIAL_MARK_LEVEL);
menuItemInitialMarkLevel.addActionListener(viewMenuActionListener);
viewMenu.add(menuItemInitialMarkLevel);
gcLineMenuItems.put(GCPreferences.INITIAL_MARK_LEVEL, menuItemInitialMarkLevel);
menuItemConcurrentGcBeginEnd = new JCheckBoxMenuItem(LocalisationHelper.getString("main_frame_menuitem_concurrent_collection_begin_end"), true);
menuItemConcurrentGcBeginEnd.setMnemonic(LocalisationHelper.getString("main_frame_menuitem_mnemonic_concurrent_collection_begin_end").charAt(0));
menuItemConcurrentGcBeginEnd.setToolTipText(LocalisationHelper.getString("main_frame_menuitem_hint_concurrent_collection_begin_end"));
menuItemConcurrentGcBeginEnd.setIcon(createMonoColoredImageIcon(ConcurrentGcBegionEndRenderer.CONCURRENT_COLLECTION_BEGIN, 20, 20));
menuItemConcurrentGcBeginEnd.setActionCommand(GCPreferences.CONCURRENT_COLLECTION_BEGIN_END);
menuItemConcurrentGcBeginEnd.addActionListener(viewMenuActionListener);
viewMenu.add(menuItemConcurrentGcBeginEnd);
gcLineMenuItems.put(GCPreferences.CONCURRENT_COLLECTION_BEGIN_END, menuItemConcurrentGcBeginEnd);
if (OSXSupport.hasOSXFullScreenSupport()) {
viewMenu.addSeparator();
viewMenu.add(new JMenuItem(osxFullScreenAction));
}
windowMenu = new JMenu(LocalisationHelper.getString("main_frame_menu_window"));
windowMenu.setMnemonic(LocalisationHelper.getString("main_frame_menu_mnemonic_window").charAt(0));
menuBar.add(windowMenu);
menuItem = new JMenuItem(arrangeAction);
windowMenu.add(menuItem);
windowMenu.addSeparator();
if ( ! OSXSupport.isOSX()) {
final JMenu helpMenu = new JMenu(LocalisationHelper.getString("main_frame_menu_help"));
helpMenu.setMnemonic(LocalisationHelper.getString("main_frame_menu_mnemonic_help").charAt(0));
menuBar.add(helpMenu);
menuItem = new JMenuItem(readmeAction);
helpMenu.add(menuItem);
menuItem = new JMenuItem(licenseAction);