01: /*
02: * Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
03: *
04: * See the file "LICENSE.txt" for information on usage and redistribution of
05: * this file, and for a DISCLAIMER OF ALL WARRANTIES.
06: */
07: package org.pnuts.tools;
08:
09: import java.awt.BorderLayout;
10: import java.awt.Dimension;
11: import java.awt.Font;
12: import javax.swing.JList;
13: import javax.swing.JPanel;
14: import javax.swing.JScrollPane;
15: import pnuts.tools.ContextEvent;
16: import pnuts.tools.ContextListener;
17:
18: public class ModulesView extends JPanel implements ContextListener {
19: private final static Font monospaced = Font.getFont("monospaced");
20: JList moduleList;
21:
22: public ModulesView() {
23: setLayout(new BorderLayout());
24: this .moduleList = new JList();
25: moduleList.setFont(monospaced);
26: moduleList.setFocusable(false);
27: moduleList.setSelectionBackground(moduleList.getBackground());
28: JScrollPane p = new JScrollPane(moduleList);
29: p.setPreferredSize(new Dimension(300, 70));
30: add(p);
31: }
32:
33: public void update(ContextEvent event) {
34: moduleList.setListData(event.getContext().usedPackages());
35: }
36: }
|