1 20 21 package org.jacorb.naming.namemanager; 22 23 import java.awt.event.*; 24 import java.awt.*; 25 import javax.swing.tree.*; 26 import javax.swing.*; 27 import org.jacorb.naming.Name; 28 import org.omg.CosNaming.*; 29 30 33 34 public class TableHandler 35 implements MouseListener, ActionListener, KeyListener 36 { 37 Component frame; 38 JTextField editName; 39 JPopupMenu popup; 40 NSTable table; 41 42 public TableHandler(Component fr, NSTable t) 43 { 44 frame=fr; 45 table = t; 46 popup=new JPopupMenu(); 47 JMenuItem unbind=new JMenuItem("Unbind name"); 48 JMenuItem call=new JMenuItem("Call Object..."); 49 50 call.setEnabled(false); 52 53 popup.add(unbind); 54 popup.add(call); 55 56 unbind.addActionListener(this); 57 call.addActionListener(this); 58 } 59 63 public void actionPerformed(ActionEvent e) 64 { 65 if (e.getActionCommand().equals("Unbind name")) 66 { 67 table.unbind(); 68 } 69 else if (e.getActionCommand().equals("Call Object...")) 70 { 71 ; 73 } 74 else 75 throw new RuntimeException ("sollte nicht auftreten"); 76 } 77 80 81 public void keyPressed(KeyEvent k) {} 82 85 86 public void keyReleased(KeyEvent k) 87 { 88 if( k.getKeyCode() == KeyEvent.VK_DELETE ) 89 table.unbind(); 90 } 91 92 public void keyTyped(KeyEvent k) {} 93 public void mouseClicked(MouseEvent e) {} 94 public void mouseEntered(MouseEvent e) {} 95 public void mouseExited(MouseEvent e) {} 96 97 public void mousePressed(MouseEvent e) {} 99 100 102 public void mouseReleased(MouseEvent e) 103 { 104 if (e.isPopupTrigger() || e.getModifiers() == java.awt.event.InputEvent.BUTTON3_MASK ) 105 { 106 popup.pack(); 107 popup.show(table, e.getX(), e.getY()); 108 } 109 } 110 111 public void windowClosing(WindowEvent e) 113 { 114 System.exit(0); 115 } 116 } 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | Popular Tags |