01: /*
02: * Created on 20-Feb-2006
03: */
04: package uk.org.ponder.swingutil;
05:
06: import java.awt.event.ActionEvent;
07: import java.awt.event.ActionListener;
08:
09: import javax.swing.JMenuItem;
10: import javax.swing.JPopupMenu;
11: import javax.swing.text.JTextComponent;
12:
13: public class CopyMenu {
14: public static JPopupMenu get(final JTextComponent target) {
15: JPopupMenu togo = new JPopupMenu();
16: JMenuItem copyitem = new JMenuItem("Copy");
17: copyitem.addActionListener(new ActionListener() {
18: public void actionPerformed(ActionEvent e) {
19: target.copy();
20: }
21: });
22: togo.add(copyitem);
23: PopupListener.add(target, togo);
24: return togo;
25: }
26: }
|