Package javax.swing

Examples of javax.swing.JPopupMenu


     
      private void showPopup(MouseEvent e) {
        
         if (e.isPopupTrigger()) {
          
           JPopupMenu popup_menu = null;
          
           switch( whichCondition() ) {
          
               case A  :  popup_menu = new JPopupMenu();
                          popup_menu.add(stop_download);
                          popup_menu.add(cancel_download);
                          popup_menu.addSeparator();
                          popup_menu.add(copy_ed2k_links);
                          popup_menu.add(paste_ed2k_links);
                          popup_menu.addSeparator();
                     //     popup_menu.add(column_setup);
                          popup_menu.add(properties);
                          break;
                         
               case B :   popup_menu = new JPopupMenu();
                              popup_menu.add(stop_download);
                              popup_menu.add(cancel_download);
                              popup_menu.addSeparator();
                              popup_menu.add(copy_ed2k_links);
                              popup_menu.add(paste_ed2k_links);
                              popup_menu.addSeparator();
                       //       popup_menu.add(column_setup);
                              popup_menu.add(properties);
                              break;
                             
               case C :   popup_menu = new JPopupMenu();
                          popup_menu.add(start_download);
                                  popup_menu.add(cancel_download);
                                  popup_menu.addSeparator();
                                  popup_menu.add(copy_ed2k_links);
                                  popup_menu.add(paste_ed2k_links);
                                  popup_menu.addSeparator();
                            //      popup_menu.add(column_setup);
                                  popup_menu.add(properties);
                                  break;
                                 
               case D :   popup_menu = new JPopupMenu();
                              popup_menu.add(start_download);
                                    popup_menu.add(cancel_download);
                                    popup_menu.addSeparator();
                                    popup_menu.add(copy_ed2k_links);
                                    popup_menu.add(paste_ed2k_links);
                                    popup_menu.addSeparator();
                             //       popup_menu.add(column_setup);
                                    popup_menu.add(properties);
                                    break;
                                 
               case E :   popup_menu = new JPopupMenu();
                          //popup_menu.add(copy_ed2k_links);
                                    popup_menu.add(paste_ed2k_links);
                            //        popup_menu.addSeparator();
                            //        popup_menu.add(column_setup);
                                    break;
                                   
               case F :   popup_menu = new JPopupMenu();
                          popup_menu.add(start_download);
                              popup_menu.add(stop_download);
                              popup_menu.add(cancel_download);
                              popup_menu.addSeparator();
                              popup_menu.add(copy_ed2k_links);
                              popup_menu.add(paste_ed2k_links);
                       //       popup_menu.addSeparator();
                       //       popup_menu.add(column_setup);
                              break;
           }
          
           popup_menu.show(e.getComponent(), e.getX(), e.getY());
         }
      } 
     
    }
   
View Full Code Here


            // }
            // Server[] servers = getServersByIndexes(selected_rows);
            // for(Server server : servers) {
            //   System.out.println(server);
            // }
            JPopupMenu popup_menu = null;
           switch( whichCondition() ) {
          
             case A : popup_menu = new JPopupMenu();
                          popup_menu.add(connect_to);
                      popup_menu.add(disconnect);
                      popup_menu.addSeparator();
                      popup_menu.add(add);
                          popup_menu.add(remove_selected);
                          popup_menu.add(remove_all);
                      popup_menu.addSeparator();
                      popup_menu.add(copy_ed2k_links);
                      popup_menu.add(paste_ed2k_links);
                      popup_menu.addSeparator();
                      popup_menu.add(add_to_static_list);
                      popup_menu.add(remove_from_static_list);
                     // popup_menu.addSeparator();
                     // popup_menu.add(column_setup);
                      popup_menu.addSeparator();
                      popup_menu.add(properties); break;
             case B : popup_menu = new JPopupMenu();
                          popup_menu.add(remove_selected);
                          popup_menu.add(remove_all);
                          popup_menu.add(add);
                          popup_menu.add(disconnect);
                      popup_menu.addSeparator();
                          popup_menu.add(copy_ed2k_links);
                          popup_menu.add(paste_ed2k_links);
                      popup_menu.addSeparator();
                      popup_menu.add(add_to_static_list);
                      popup_menu.add(remove_from_static_list);
                    //  popup_menu.addSeparator();
                        //  popup_menu.add(column_setup);
                      break;
             case D : popup_menu = new JPopupMenu();
                      popup_menu.add(connect_to);
                      popup_menu.addSeparator();
                          popup_menu.add(add);
                          popup_menu.add(remove_selected);
                          popup_menu.add(remove_all);
                          popup_menu.addSeparator();
                          popup_menu.add(copy_ed2k_links);
                          popup_menu.add(paste_ed2k_links);                         
                          popup_menu.addSeparator();
                      popup_menu.add(add_to_static_list);
                      popup_menu.add(remove_from_static_list);
                   //   popup_menu.addSeparator();
                       //   popup_menu.add(column_setup);
                          popup_menu.addSeparator();
                          popup_menu.add(properties); break;
             case E : popup_menu = new JPopupMenu();
                      popup_menu.add(remove_selected);
                          popup_menu.add(add);
                          popup_menu.add(remove_all);
                          popup_menu.addSeparator();
                          popup_menu.add(copy_ed2k_links);
                          popup_menu.add(paste_ed2k_links);
                          popup_menu.addSeparator();
                          popup_menu.add(add_to_static_list);
                      popup_menu.add(remove_from_static_list);
                   //   popup_menu.addSeparator();
                      //    popup_menu.add(column_setup);
                      break;
             case F : popup_menu = new JPopupMenu();
                          popup_menu.add(add);
                          popup_menu.add(paste_ed2k_links);
                          popup_menu.addSeparator();
                          popup_menu.add(column_setup); break;
             case G : popup_menu = new JPopupMenu();
                      popup_menu.add(remove_selected);
                          popup_menu.add(add);
                          popup_menu.add(remove_all);
                          popup_menu.add(disconnect);
                          popup_menu.addSeparator();
                          popup_menu.add(copy_ed2k_links);
                          popup_menu.add(paste_ed2k_links);
                          popup_menu.addSeparator();
                      popup_menu.add(add_to_static_list);
                      popup_menu.add(remove_from_static_list);
                   //   popup_menu.addSeparator();
                        //  popup_menu.add(column_setup);
                          popup_menu.addSeparator();
                          popup_menu.add(properties); break;
             case H : popup_menu = new JPopupMenu();
                      popup_menu.add(remove_selected);
                          popup_menu.add(add);
                          popup_menu.add(remove_all);
                          popup_menu.add(disconnect);
                          popup_menu.addSeparator();
                          popup_menu.add(copy_ed2k_links);
                          popup_menu.add(paste_ed2k_links);
                          popup_menu.addSeparator();
                      popup_menu.add(add_to_static_list);
                      popup_menu.add(remove_from_static_list);
                   //   popup_menu.addSeparator();
                       //   popup_menu.add(column_setup); break;
           
           }
          
           // set enabled/disabled for static list commands
           Server[] selected_servers = getSelectedServers();
           add_to_static_list.setEnabled(true);
           remove_from_static_list.setEnabled(true);
           boolean add_to_static_enabled = true;
           boolean remove_from_static_enabled = true;
           for(Server server : selected_servers) {
             if(server.isStatic()) {
               add_to_static_enabled = false;
             } else {
               remove_from_static_enabled = false;
             }
           }
           if( ( add_to_static_enabled == false ) && ( remove_from_static_enabled != false ) ) {
 
             add_to_static_list.setEnabled(false);
           }
           if( ( add_to_static_enabled != false ) && ( remove_from_static_enabled == false ) ) {

             remove_from_static_list.setEnabled(false);
           }
            popup_menu.show(e.getComponent(), e.getX(), e.getY());
           }
       }
    }
    this.addMouseListener(new PopupListener());
 
View Full Code Here

            // }
            // Server[] servers = getServersByIndexes(selected_rows);
            // for(Server server : servers) {
            //   System.out.println(server);
            // }
            JPopupMenu popup_menu = null;
           switch( whichCondition() ) {
          
             case A : popup_menu = new JPopupMenu();
                          popup_menu.add(connect_to);
                      popup_menu.add(disconnect);
                      popup_menu.addSeparator();
                      popup_menu.add(add);
                          popup_menu.add(remove_selected);
                          popup_menu.add(remove_all);
                      popup_menu.addSeparator();
                      popup_menu.add(copy_ed2k_links);
                      popup_menu.add(paste_ed2k_links);
                      popup_menu.addSeparator();
                      popup_menu.add(add_to_static_list);
                      popup_menu.add(remove_from_static_list);
                     // popup_menu.addSeparator();
                     // popup_menu.add(column_setup);
                      popup_menu.addSeparator();
                      popup_menu.add(properties); break;
             case B : popup_menu = new JPopupMenu();
                          popup_menu.add(remove_selected);
                          popup_menu.add(remove_all);
                          popup_menu.add(add);
                          popup_menu.add(disconnect);
                      popup_menu.addSeparator();
                          popup_menu.add(copy_ed2k_links);
                          popup_menu.add(paste_ed2k_links);
                      popup_menu.addSeparator();
                      popup_menu.add(add_to_static_list);
                      popup_menu.add(remove_from_static_list);
                    //  popup_menu.addSeparator();
                        //  popup_menu.add(column_setup);
                      break;
             case D : popup_menu = new JPopupMenu();
                      popup_menu.add(connect_to);
                      popup_menu.addSeparator();
                          popup_menu.add(add);
                          popup_menu.add(remove_selected);
                          popup_menu.add(remove_all);
                          popup_menu.addSeparator();
                          popup_menu.add(copy_ed2k_links);
                          popup_menu.add(paste_ed2k_links);                         
                          popup_menu.addSeparator();
                      popup_menu.add(add_to_static_list);
                      popup_menu.add(remove_from_static_list);
                   //   popup_menu.addSeparator();
                       //   popup_menu.add(column_setup);
                          popup_menu.addSeparator();
                          popup_menu.add(properties); break;
             case E : popup_menu = new JPopupMenu();
                      popup_menu.add(remove_selected);
                          popup_menu.add(add);
                          popup_menu.add(remove_all);
                          popup_menu.addSeparator();
                          popup_menu.add(copy_ed2k_links);
                          popup_menu.add(paste_ed2k_links);
                          popup_menu.addSeparator();
                          popup_menu.add(add_to_static_list);
                      popup_menu.add(remove_from_static_list);
                   //   popup_menu.addSeparator();
                      //    popup_menu.add(column_setup);
                      break;
             case F : popup_menu = new JPopupMenu();
                          popup_menu.add(add);
                          popup_menu.add(paste_ed2k_links);
                          popup_menu.addSeparator();
                          popup_menu.add(column_setup); break;
             case G : popup_menu = new JPopupMenu();
                      popup_menu.add(remove_selected);
                          popup_menu.add(add);
                          popup_menu.add(remove_all);
                          popup_menu.add(disconnect);
                          popup_menu.addSeparator();
                          popup_menu.add(copy_ed2k_links);
                          popup_menu.add(paste_ed2k_links);
                          popup_menu.addSeparator();
                      popup_menu.add(add_to_static_list);
                      popup_menu.add(remove_from_static_list);
                   //   popup_menu.addSeparator();
                        //  popup_menu.add(column_setup);
                          popup_menu.addSeparator();
                          popup_menu.add(properties); break;
             case H : popup_menu = new JPopupMenu();
                      popup_menu.add(remove_selected);
                          popup_menu.add(add);
                          popup_menu.add(remove_all);
                          popup_menu.add(disconnect);
                          popup_menu.addSeparator();
                          popup_menu.add(copy_ed2k_links);
                          popup_menu.add(paste_ed2k_links);
                          popup_menu.addSeparator();
                      popup_menu.add(add_to_static_list);
                      popup_menu.add(remove_from_static_list);
                   //   popup_menu.addSeparator();
                       //   popup_menu.add(column_setup); break;
           
           }
          
           // set enabled/disabled for static list commands
           Server[] selected_servers = getSelectedServers();
           add_to_static_list.setEnabled(true);
           remove_from_static_list.setEnabled(true);
           boolean add_to_static_enabled = true;
           boolean remove_from_static_enabled = true;
           for(Server server : selected_servers) {
             if(server.isStatic()) {
               add_to_static_enabled = false;
             } else {
               remove_from_static_enabled = false;
             }
           }
           if( ( add_to_static_enabled == false ) && ( remove_from_static_enabled != false ) ) {
 
             add_to_static_list.setEnabled(false);
           }
           if( ( add_to_static_enabled != false ) && ( remove_from_static_enabled == false ) ) {

             remove_from_static_list.setEnabled(false);
           }
            popup_menu.show(e.getComponent(), e.getX(), e.getY());
           }
       }
View Full Code Here

     
      private void showPopup(MouseEvent e) {
        
         if (e.isPopupTrigger()) {
          
           JPopupMenu popup_menu = null;
         
           switch( whichCondition() ) {
            
              case  A  :  popup_menu = new JPopupMenu();
                          //popup_menu.add(column_setup);
                          //popup_menu.addSeparator();
                          popup_menu.add(properties);
                          break;
                         
              case B   :  //popup_menu = new JPopupMenu();
                          //popup_menu.add(column_setup);
                          break;
                         
              case C   : // popup_menu = new JPopupMenu();
                               // popup_menu.add(column_setup);
                                break;
           }
          
           popup_menu.show(e.getComponent(), e.getX(), e.getY());
         }
      } 
     
    }
   
View Full Code Here

     
      private void showPopup(MouseEvent e) {
        
         if (e.isPopupTrigger()) {
          
           JPopupMenu popup_menu = null;
         
           switch( whichCondition() ) {
            
              case  A  :  popup_menu = new JPopupMenu();
                          //popup_menu.add(column_setup);
                          //popup_menu.addSeparator();
                          popup_menu.add(properties);
                          break;
                         
              case B   :  //popup_menu = new JPopupMenu();
                          //popup_menu.add(column_setup);
                          break;
                         
              case C   : // popup_menu = new JPopupMenu();
                               // popup_menu.add(column_setup);
                                break;
           }
          
           popup_menu.show(e.getComponent(), e.getX(), e.getY());
         }
      } 
View Full Code Here

     
      private void showPopup(MouseEvent e) {
        
         if (e.isPopupTrigger()) {
          
           JPopupMenu popup_menu = null;
          
           switch( whichCondition() ) {
          
               case A  :  popup_menu = new JPopupMenu();
                          popup_menu.add(stop_download);
                          popup_menu.add(cancel_download);
                          popup_menu.addSeparator();
                          popup_menu.add(copy_ed2k_links);
                          popup_menu.add(paste_ed2k_links);
                          popup_menu.addSeparator();
                     //     popup_menu.add(column_setup);
                          popup_menu.add(properties);
                          break;
                         
               case B :   popup_menu = new JPopupMenu();
                              popup_menu.add(stop_download);
                              popup_menu.add(cancel_download);
                              popup_menu.addSeparator();
                              popup_menu.add(copy_ed2k_links);
                              popup_menu.add(paste_ed2k_links);
                              popup_menu.addSeparator();
                       //       popup_menu.add(column_setup);
                              popup_menu.add(properties);
                              break;
                             
               case C :   popup_menu = new JPopupMenu();
                          popup_menu.add(start_download);
                                  popup_menu.add(cancel_download);
                                  popup_menu.addSeparator();
                                  popup_menu.add(copy_ed2k_links);
                                  popup_menu.add(paste_ed2k_links);
                                  popup_menu.addSeparator();
                            //      popup_menu.add(column_setup);
                                  popup_menu.add(properties);
                                  break;
                                 
               case D :   popup_menu = new JPopupMenu();
                              popup_menu.add(start_download);
                                    popup_menu.add(cancel_download);
                                    popup_menu.addSeparator();
                                    popup_menu.add(copy_ed2k_links);
                                    popup_menu.add(paste_ed2k_links);
                                    popup_menu.addSeparator();
                             //       popup_menu.add(column_setup);
                                    popup_menu.add(properties);
                                    break;
                                 
               case E :   popup_menu = new JPopupMenu();
                          //popup_menu.add(copy_ed2k_links);
                                    popup_menu.add(paste_ed2k_links);
                            //        popup_menu.addSeparator();
                            //        popup_menu.add(column_setup);
                                    break;
                                   
               case F :   popup_menu = new JPopupMenu();
                          popup_menu.add(start_download);
                              popup_menu.add(stop_download);
                              popup_menu.add(cancel_download);
                              popup_menu.addSeparator();
                              popup_menu.add(copy_ed2k_links);
                              popup_menu.add(paste_ed2k_links);
                       //       popup_menu.addSeparator();
                       //       popup_menu.add(column_setup);
                              break;
           }
          
           popup_menu.show(e.getComponent(), e.getX(), e.getY());
         }
      } 
View Full Code Here

     
      private void showPopup(MouseEvent e) {
        
         if (e.isPopupTrigger()) {
          
           JPopupMenu popup_menu = new JPopupMenu();
         
           popup_menu.add(column_setup);
          
           popup_menu.show(e.getComponent(), e.getX(), e.getY());
         }
      } 
     
    }
   
View Full Code Here

     
      private void showPopup(MouseEvent e) {
        
         if (e.isPopupTrigger()) {
          
           JPopupMenu popup_menu = new JPopupMenu();
         
           popup_menu.add(column_setup);
          
           popup_menu.show(e.getComponent(), e.getX(), e.getY());
         }
      } 
View Full Code Here

    
     serverListScrollPane.setPreferredSize(new Dimension(300,200));
     serverMessagesScrollPane.setPreferredSize(new Dimension(200,300));
    
     // Clear server messages popup menu
     final JPopupMenu popup_menu = new JPopupMenu();
     JMenuItem clear_menu_item = new JMenuItem("Clear");
     clear_menu_item.addActionListener(new ActionListener() {
       public void actionPerformed(ActionEvent event) {
         serverMessages.setText("");
       }
     });
     popup_menu.add(clear_menu_item);
   
    class MousePopupListener extends MouseAdapter {
        public void mousePressed(MouseEvent e) {
          checkPopup(e);
        }

        public void mouseClicked(MouseEvent e) {
          checkPopup(e);
        }

        public void mouseReleased(MouseEvent e) {
          checkPopup(e);
        }

        private void checkPopup(MouseEvent e) {
          if (e.isPopupTrigger()) {
            popup_menu.show(e.getComponent(), e.getX(), e.getY());
          }
        }
    }
     serverMessages.addMouseListener(new MousePopupListener());
     setServerListCount();
View Full Code Here

     
      private void showPopup(MouseEvent e) {
        
         if (e.isPopupTrigger()) {
          
           JPopupMenu popup_menu = new JPopupMenu();
         
           popup_menu.add(column_setup);
          
           popup_menu.show(e.getComponent(), e.getX(), e.getY());
         }
      } 
     
    }
   
View Full Code Here

TOP

Related Classes of javax.swing.JPopupMenu

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.