3 * 2005年かー。ずいぶん前のを流用してるんだなあ。
7 import java.awt.event.*;
9 import javax.swing.text.*;
13 * タイトル: ポケモンセーブデータエディタ for GBA
21 * 著作権: Copyright (c) 2005 PSI
31 public class PopupRightClick extends MouseAdapter implements ActionListener {
38 public static final String Actin_Cut = "CO";
39 public static final String Actin_Copy = "CU";
40 public static final String Actin_Paste = "P";
41 private boolean pressed = false;
43 public PopupRightClick(JTextComponent owner) {
45 popup = new JPopupMenu("メニュー");
46 CopyMenu = new JMenuItem("コピー(CTRL + C)");
47 CopyMenu.setActionCommand(Actin_Copy);
48 CopyMenu.addActionListener(this);
51 CutMenu = new JMenuItem("切り取り(CTRL + X)");
52 CutMenu.setActionCommand(Actin_Cut);
53 CutMenu.addActionListener(this);
56 PasteMenu = new JMenuItem("貼り付け(CTRL + V)");
57 PasteMenu.setActionCommand(Actin_Paste);
58 PasteMenu.addActionListener(this);
63 * Invoked when the mouse exits a component.
69 public void mouseExited(MouseEvent e) {
74 * Invoked when a mouse button has been pressed on a component.
80 public void mousePressed(MouseEvent e) {
85 * Invoked when a mouse button has been released on a component.
91 public void mouseReleased(MouseEvent e) {
93 if (pressed && SwingUtilities.isRightMouseButton(e)) {
94 popup.show(e.getComponent(), e.getX(), e.getY());
106 public void actionPerformed(ActionEvent e) {
107 String ActionCommand = e.getActionCommand();
108 if (ActionCommand.equals(Actin_Cut)) { // カット
110 } else if (ActionCommand.equals(Actin_Copy)) { // コピー
112 } else if (ActionCommand.equals(Actin_Paste)) { // 貼り付け