Query GUI finished pretty cool view
[RRRRHHHH_Code] / ruralHouses / src / gui / QueryAvailabilityGUI.java
index e34ec02..557cca4 100644 (file)
@@ -255,4 +255,21 @@ private static final long serialVersionUID = 1L;
 
           labelNoOffers.setText(e1.getMessage());
        }}      
+       private static void addPopup(Component component, final JPopupMenu popup) {
+               component.addMouseListener(new MouseAdapter() {
+                       public void mousePressed(MouseEvent e) {
+                               if (e.isPopupTrigger()) {
+                                       showMenu(e);
+                               }
+                       }
+                       public void mouseReleased(MouseEvent e) {
+                               if (e.isPopupTrigger()) {
+                                       showMenu(e);
+                               }
+                       }
+                       private void showMenu(MouseEvent e) {
+                               popup.show(e.getComponent(), e.getX(), e.getY());
+                       }
+               });
+       }
 }
\ No newline at end of file