1 21 package org.jacorb.poa.gui.beans; 22 23 public class ExtendedPopupMenu 24 extends java.awt.PopupMenu 25 { 26 private java.awt.Component fieldOwnerComponent = null; 27 28 protected transient java.beans.PropertyChangeSupport propertyChange = 29 new java.beans.PropertyChangeSupport (this); 30 33 34 public ExtendedPopupMenu() { 35 super(); 36 initialize(); 37 } 38 42 public ExtendedPopupMenu(java.lang.String label) { 43 super(label); 44 } 45 48 public synchronized void addPropertyChangeListener(java.beans.PropertyChangeListener listener) { 49 propertyChange.addPropertyChangeListener(listener); 50 } 51 54 public void firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue) { 55 propertyChange.firePropertyChange(propertyName, oldValue, newValue); 56 } 57 62 public java.awt.Component getOwnerComponent() { 63 64 return fieldOwnerComponent; 65 } 66 70 private void handleException(Throwable exception) { 71 72 73 } 76 79 80 private void initialize() { 81 } 86 90 public static void main(java.lang.String [] args) { 91 try { 92 org.jacorb.poa.gui.beans.ExtendedPopupMenu aExtendedPopupMenu = 93 new org.jacorb.poa.gui.beans.ExtendedPopupMenu(); 94 } catch (Throwable exception) { 95 System.err.println("Exception occurred in main() of hyperocm.beans.PopupMenu"); 96 exception.printStackTrace(System.out); 97 } 98 } 99 102 public synchronized void removePropertyChangeListener(java.beans.PropertyChangeListener listener) { 103 propertyChange.removePropertyChangeListener(listener); 104 } 105 110 public void setOwnerComponent(java.awt.Component ownerComponent) { 111 112 java.awt.Component oldValue = fieldOwnerComponent; 113 114 fieldOwnerComponent = ownerComponent; 115 116 firePropertyChange("ownerComponent", oldValue, ownerComponent); 117 return; 118 } 119 123 public void show(java.awt.event.MouseEvent mouseEvent) { 124 125 if (mouseEvent != null && mouseEvent.isPopupTrigger()) 126 { 127 java.awt.Component popupOwner = mouseEvent.getComponent(); 128 if (popupOwner != null) 129 { 130 setOwnerComponent(popupOwner); 131 popupOwner.add(this); 132 show(popupOwner, mouseEvent.getX(), mouseEvent.getY()); 133 } 134 } 135 } 136 140 public void showCertainly(java.awt.event.MouseEvent mouseEvent) { 141 142 java.awt.Component popupOwner = mouseEvent.getComponent(); 143 if (popupOwner != null) 144 { 145 setOwnerComponent(popupOwner); 146 popupOwner.add(this); 147 show(popupOwner, mouseEvent.getX(), mouseEvent.getY()); 148 } 149 } 150 151 } 152 153 154 155 156 157 158 159 160 161 162 163 164 | Popular Tags |