3 * 2005年かー。ずいぶん前のを流用してるんだなあ。
7 import java.awt.event.*;
9 import javax.swing.text.*;
13 * タイトル: ポケモンセーブデータエディタ for GBA
21 * 著作権: Copyright (c) 2005 PSI
31 public class PopupRightClick implements MouseListener, ActionListener {
42 public static final String Actin_Cut = "CO";
44 public static final String Actin_Copy = "CU";
46 public static final String Actin_Paste = "P";
48 private boolean pressed = false;
50 public PopupRightClick(JTextComponent owner) {
52 popup = new JPopupMenu("メニュー");
53 CopyMenu = new JMenuItem("コピー(CTRL + C)");
54 CopyMenu.setActionCommand(Actin_Copy);
55 CopyMenu.addActionListener(this);
58 CutMenu = new JMenuItem("切り取り(CTRL + X)");
59 CutMenu.setActionCommand(Actin_Cut);
60 CutMenu.addActionListener(this);
63 PasteMenu = new JMenuItem("貼り付け(CTRL + V)");
64 PasteMenu.setActionCommand(Actin_Paste);
65 PasteMenu.addActionListener(this);
70 * Invoked when the mouse button has been clicked (pressed and released) on
75 * @todo この java.awt.event.MouseListener メソッドを実装
77 public void mouseClicked(MouseEvent e) {
81 * Invoked when the mouse enters a component.
85 * @todo この java.awt.event.MouseListener メソッドを実装
87 public void mouseEntered(MouseEvent e) {
91 * Invoked when the mouse exits a component.
95 * @todo この java.awt.event.MouseListener メソッドを実装
97 public void mouseExited(MouseEvent e) {
102 * Invoked when a mouse button has been pressed on a component.
106 * @todo この java.awt.event.MouseListener メソッドを実装
108 public void mousePressed(MouseEvent e) {
113 * Invoked when a mouse button has been released on a component.
117 * @todo この java.awt.event.MouseListener メソッドを実装
119 public void mouseReleased(MouseEvent e) {
121 if (pressed && SwingUtilities.isRightMouseButton(e)) {
122 popup.show(e.getComponent(), e.getX(), e.getY());
132 * @todo この java.awt.event.ActionListener メソッドを実装
134 public void actionPerformed(ActionEvent e) {
135 String ActionCommand = e.getActionCommand();
136 if (ActionCommand.equals(Actin_Cut)) { // カット
138 } else if (ActionCommand.equals(Actin_Copy)) { // コピー
140 } else if (ActionCommand.equals(Actin_Paste)) { // 貼り付け