public void actionPerformed(ActionEvent e) { super.actionPerformed(e); JMenuItem jmi = (JMenuItem) e.getSource(); if (displayset.contains(jmi)) { mainPanel.setNames(jmi.getText()); } else if (jmi == hiddenItem) { mainPanel.showIgnored(hiddenItem.isSelected()); } else if (jmi == aggrItem) { mainPanel.showAggregates(aggrItem.isSelected()); } }
/** * Create a JFSstat demo. * * @param jkstat a JKstat object * @param standalone if false, indicates that this demo is being called from another application */ public JFSstat(JKstat jkstat, boolean standalone) { super("jfsstat", standalone); mainPanel = new JFSstatPanel(jkstat, DEFAULT_INTERVAL); setContentPane(mainPanel); addInfoPanel(mainPanel, sversion); displayset = new HashSet<JRadioButtonMenuItem>(); JMenu displayMenu = new JMenu(SolViewResources.getString("FSSTAT.DISPLAY.TEXT")); displayMenu.setMnemonic(KeyEvent.VK_D); String curtitle = mainPanel.currentTitle(); ButtonGroup displayGroup = new ButtonGroup(); for (String title : mainPanel.titles()) { JRadioButtonMenuItem jmis = new JRadioButtonMenuItem(title, title.equals(curtitle)); displayMenu.add(jmis); displayGroup.add(jmis); displayset.add(jmis); jmis.addActionListener(this); } addMenu(displayMenu); JMenu showMenu = new JMenu(SolViewResources.getString("FSSTAT.SHOW.TEXT")); showMenu.setMnemonic(KeyEvent.VK_S); hiddenItem = new JCheckBoxMenuItem(SolViewResources.getString("FSSTAT.HIDDEN.TEXT"), false); hiddenItem.addActionListener(this); showMenu.add(hiddenItem); aggrItem = new JCheckBoxMenuItem(SolViewResources.getString("FSSTAT.FSTYPE.TEXT"), false); aggrItem.addActionListener(this); showMenu.add(aggrItem); addMenu(showMenu); setSize(620, 250); validate(); setVisible(true); }
@Override public void setDelay(int i) { mainPanel.setDelay(i); setLabelDelay(i); }
@Override public void stopLoop() { mainPanel.stopLoop(); }