jTracer  1.03
Stack trace visualization tool
void org.libcsdbg.jtracer.MenuBar.listSessions ( Vector  list,
int  sel 
)

Update the session list menu.

Parameters
[in]listthe list of currently opened sessions
[in]selthe currently selected (focused) session index

Definition at line 162 of file MenuBar.java.

References org.libcsdbg.jtracer.Registry.get(), and org.libcsdbg.jtracer.MenuBar.handler.

163  {
164  JMenu menu = getMenu(2);
165  while (menu.getMenuComponentCount() > 8)
166  menu.remove(8);
167 
168  int cnt = list.size();
169  if (cnt == 0)
170  return;
171 
172  menu.addSeparator();
173  Registry conf = Registry.getCurrent();
174  Font fnt = (Font) conf.get("component", "font");
175  Color fg = (Color) conf.get("component", "fgcolor");
176  Integer delay = (Integer) conf.get("component", "click-delay");
177  ImageIcon onIcon = conf.loadIcon("on16.png");
178  ImageIcon offIcon = conf.loadIcon("voidrect16.png");
179 
180  for (int i = 0; i < cnt; i++) {
181  JFrame sess = (JFrame) list.get(i);
182 
183  JMenuItem item = new JMenuItem(sess.getTitle() + " ");
184  item.setFont(fnt);
185  item.setForeground(fg);
186  if (delay != null)
187  item.setMultiClickThreshhold(delay);
188 
189  if (i < 10) {
190  int accel = VK_0 + i;
191  KeyStroke ks = KeyStroke.getKeyStroke(accel, InputEvent.ALT_DOWN_MASK);
192  item.setAccelerator(ks);
193  }
194 
195  item.setIcon((i == sel) ? onIcon : offIcon);
196  item.setActionCommand("Select session " + i);
197  item.addActionListener(handler);
198  menu.add(item);
199  }
200  }
ActionListener handler
Event handler.
Definition: MenuBar.java:46

+ Here is the call graph for this function: