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.Color;
10: import java.awt.Font;
11: import javax.swing.JTextField;
12: import pnuts.tools.ContextEvent;
13: import pnuts.tools.ContextListener;
14:
15: public class CurrentPackageView extends JTextField implements
16: ContextListener {
17: private final static Font monospaced = Font.getFont("monospaced");
18:
19: public CurrentPackageView() {
20: super (20);
21: setEditable(false);
22: setBackground(Color.white);
23: setSelectionColor(Color.white);
24: setFont(monospaced);
25: setAutoscrolls(true);
26: }
27:
28: public void update(ContextEvent event) {
29: setText(String.valueOf(event.getContext().getCurrentPackage()));
30: }
31: }
|