Package javax.swing

Examples of javax.swing.JMenuItem$AccessibleJMenuItem


        if ((sel != null) && (sel instanceof ContextualActionProvider)) {
            ContextualActionProvider provider = (ContextualActionProvider) sel;
            String[] actions = provider.getActions(x, y, sel, ContextualActionProvider.SOURCELIST_CONTEXT);
            if ((actions != null) && (actions.length != 0)) {
                for (int i = 0; i < actions.length; ++i) {
                    JMenuItem jmi = new JMenuItem(actions[i]);
                    if (!provider.canDoAction(x, y, sel, actions[i], ContextualActionProvider.SOURCELIST_CONTEXT)) {
                        jmi.setEnabled(false);
                    } else {
                        jmi.addActionListener(this);
                    }
                    add(jmi);
                    popup.add(jmi);
                }
            }
View Full Code Here


            JOptionPane.showMessageDialog(JSynoptic.gui.getOwner(), infos.toArray(), messageWriter
                    .print0args("sourceInfo"), JOptionPane.INFORMATION_MESSAGE);
            return;
        }
        if (e.getSource() instanceof JMenuItem) {
            JMenuItem jmi = (JMenuItem) e.getSource();
            Object o = getSelectedSourceOrCollection();
            if (!(o instanceof ContextualActionProvider)) {
                return;
            }
           
            if (o instanceof ContextualActionProvider) {
                ((ContextualActionProvider) o).doAction(actionX, actionY, o, jmi.getText(), null);
            }
           
            return;
        }
        super.actionPerformed(e);
View Full Code Here

      final LinkedHashMap commonActions=pactions;
      Iterator it=commonActions.keySet().iterator();
      while(it.hasNext()){
        final String actionName =(String)it.next();
        Icon icon =(commonActions.get(actionName) instanceof Icon)(Icon)commonActions.get(actionName) : null;
        JMenuItem jmi = ActionPopup.createMenuItem(menu, actionName, icon);
        jmi.addActionListener(new CollectiveActionListener(x, y, getSelectedSource(), actionName))
      }
      return true;
    }
View Full Code Here

            JSynoptic.gui.addEditMenu(popup);
        }
        if(getElementContainer().getSelection().isEmpty()){
          // no selection add background color menu
          popup.addSeparator();
          popup.add(new JMenuItem(new AbstractAction(
              resources.getStringValue("backgroundColorAction")) {
            public void actionPerformed(ActionEvent e) {
              Color c=showColorDialog(ShapesContainer.this._diagParam.backgr);
              if(c!=null){
                ShapesContainer.this._diagParam.backgr=c;
View Full Code Here

   
    class PopupListener extends MouseAdapter {
      JMenuItem start_download, try_again, copy_ed2k_links, close,
                column_setup, properties;
      public PopupListener() {
        start_download = new JMenuItem("Download");
        start_download.setIcon(ImgRep.getIcon("start_download.png"));
        start_download.addActionListener(new ActionListener() {
           public void actionPerformed(ActionEvent event) {
                         List<SearchResultItem> new_files = getFilesByStatus(FileStatus.NEW);
                         for(SearchResultItem result : new_files) {
                          try {
                           _download_manager.addDownload(result);
                           _download_manager.startDownload(result.getFileHash());
                          }catch(Throwable cause) {
                            cause.printStackTrace();
                          }
                         }
           }
        });
        try_again = new JMenuItem("Try again");
        try_again.setIcon(ImgRep.getIcon("refresh.png"));
        try_again.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent event) {
               System.out.println("Try again action performed")
          }
        });
        copy_ed2k_links = new JMenuItem("Copy ED2K link(s)");
        copy_ed2k_links.setIcon(ImgRep.getIcon("ed2k_link.png"));
        copy_ed2k_links.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            clipboard.setContents(new Transferable() {
              public Object getTransferData(DataFlavor flavor)
                  throws UnsupportedFlavorException,
                  IOException {
                String ed2k_links = "";
                SearchResultItem[] result_items = getSelectedFiles();
                for(SearchResultItem result_item : result_items) {
                  ed2k_links += result_item.getAsED2KLink().getAsString() + System.getProperty("line.separator");
                }
                return ed2k_links;
              }

              public DataFlavor[] getTransferDataFlavors() {
                DataFlavor[] data_flavours = new DataFlavor[1];
                data_flavours[0] = DataFlavor.stringFlavor;
                return data_flavours;
              }

              public boolean isDataFlavorSupported(
                  DataFlavor flavor) {
                  return flavor.isFlavorTextType();
              }
             
            }, new ClipboardOwner() {

              public void lostOwnership(Clipboard clipboard, Transferable contents) {
               
              }
             
            })
          }
        });
        close = new JMenuItem("Close");
        close.setIcon(ImgRep.getIcon("cancel.png"));
        close.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            tabbedPanel.remove(search_result_pane);
          }
        });
        column_setup = new JMenuItem("Column setup");
        column_setup.setIcon(ImgRep.getIcon("columns_setup.png"));
        column_setup.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent event) {
              System.out.println("Column setup action performed")
          }
        });
        properties = new JMenuItem("Properties");
        properties.setIcon(ImgRep.getIcon("info.png"));
        properties.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            System.out.println("Properties action performed");
          }
View Full Code Here

      right_panel.add(download_speed);
      right_panel.add(upload_speed);
      this.add(left_panel,BorderLayout.WEST);
      this.add(right_panel,BorderLayout.EAST);
     
      JMenuItem adjust_speeds = new JMenuItem("Adjust speed limits");
      adjust_speeds.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
          SwingUtils.setWindowLocationRelativeTo(speed_limits_dialog, frame);
          speed_limits_dialog.setVisible(true);         
        }
      });
View Full Code Here

   
    class PopupListener extends MouseAdapter {
      JMenuItem start_download, try_again, copy_ed2k_links, close,
                column_setup, properties;
      public PopupListener() {
        start_download = new JMenuItem("Download");
        start_download.setIcon(ImgRep.getIcon("start_download.png"));
        start_download.addActionListener(new ActionListener() {
           public void actionPerformed(ActionEvent event) {
                         List<SearchResultItem> new_files = getFilesByStatus(FileStatus.NEW);
                         for(SearchResultItem result : new_files) {
                          try {
                           _download_manager.addDownload(result);
                           _download_manager.startDownload(result.getFileHash());
                          }catch(Throwable cause) {
                            cause.printStackTrace();
                          }
                         }
           }
        });
        try_again = new JMenuItem("Try again");
        try_again.setIcon(ImgRep.getIcon("refresh.png"));
        try_again.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent event) {
               System.out.println("Try again action performed")
          }
        });
        copy_ed2k_links = new JMenuItem("Copy ED2K link(s)");
        copy_ed2k_links.setIcon(ImgRep.getIcon("ed2k_link.png"));
        copy_ed2k_links.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            clipboard.setContents(new Transferable() {
              public Object getTransferData(DataFlavor flavor)
                  throws UnsupportedFlavorException,
                  IOException {
                String ed2k_links = "";
                SearchResultItem[] result_items = getSelectedFiles();
                for(SearchResultItem result_item : result_items) {
                  ed2k_links += result_item.getAsED2KLink().getAsString() + System.getProperty("line.separator");
                }
                return ed2k_links;
              }

              public DataFlavor[] getTransferDataFlavors() {
                DataFlavor[] data_flavours = new DataFlavor[1];
                data_flavours[0] = DataFlavor.stringFlavor;
                return data_flavours;
              }

              public boolean isDataFlavorSupported(
                  DataFlavor flavor) {
                  return flavor.isFlavorTextType();
              }
             
            }, new ClipboardOwner() {

              public void lostOwnership(Clipboard clipboard, Transferable contents) {
               
              }
             
            })
          }
        });
        close = new JMenuItem("Close");
        close.setIcon(ImgRep.getIcon("cancel.png"));
        close.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            tabbedPanel.remove(search_result_pane);
          }
        });
        column_setup = new JMenuItem("Column setup");
        column_setup.setIcon(ImgRep.getIcon("columns_setup.png"));
        column_setup.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent event) {
              System.out.println("Column setup action performed")
          }
        });
        properties = new JMenuItem("Properties");
        properties.setIcon(ImgRep.getIcon("info.png"));
        properties.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            System.out.println("Properties action performed");
          }
View Full Code Here

    } catch (Exception evt) {
      evt.printStackTrace();
    }

    JPopupMenu menu = new JPopupMenu();
    JMenuItem item;

    item = new JMenuItem(mLocalizer.msg("search", "Search"));
    item.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent evt) {
        DesktopToolkit.openPageInBrowser("searchinput.jsp");
      }
    });
    menu.add(item);

    item = new JMenuItem(mLocalizer.msg("status", "Status"));
    item.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent evt) {
        DesktopToolkit.openPageInBrowser("status.jsp");
      }
    });
    menu.add(item);
   
    item = new JMenuItem(mLocalizer.msg("config", "Preferences"));
    item.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent evt) {
        DesktopToolkit.openPageInBrowser("config.jsp");
      }
    });
    menu.add(item);

    menu.addSeparator();
   
    item = new JMenuItem(mLocalizer.msg("exit", "Exit"));
    item.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent evt) {
        Main.quit();
      }
    });
    menu.add(item);
View Full Code Here

        menu = new JMenu();
        menu.getPopupMenu().addContainerListener(new MenuContainerListener());

        if (actions != null){
            for(int i=0;i < actions.size();i++){
                JMenuItem mi = new JMenuItem( (Action)actions.get(i));
                menu.add(mi);
                mi.addActionListener(new MenuItemActionListener());
            }

            // Set the current action to the first action
            setCurrentAction((Action)actions.get(0));
        }
View Full Code Here

     
      JMenuItem start_download, stop_download, cancel_download,
                    paste_ed2k_links, copy_ed2k_links, column_setup, properties;
     
      public PopupListener() {
         start_download = new JMenuItem("Start download");
         start_download.setIcon(ImgRep.getIcon("start_download.png"));
         start_download.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            for(DownloadSession session : getSelectedDownloadSessions())
              if(session.getStatus() == DownloadStatus.STOPPED
              try {
                _download_manager.startDownload(session.getFileHash());
              }catch(Throwable cause) {
                cause.printStackTrace();
              }
          }
         });
         stop_download = new JMenuItem("Stop download");
         stop_download.setIcon(ImgRep.getIcon("stop_download.png"));
         stop_download.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            for(DownloadSession session : getSelectedDownloadSessions())
              if(session.getStatus() == DownloadStatus.STARTED
               try {
              _download_manager.startDownload(session.getFileHash());
               }catch( Throwable cause ) {
                 cause.printStackTrace();
               }
          }
         });
         cancel_download = new JMenuItem("Cancel download");
         cancel_download.setIcon(ImgRep.getIcon("cancel.png"));
         cancel_download.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            for(DownloadSession session : getSelectedDownloadSessions())
              try {
              _download_manager.cancelDownload(session.getFileHash());
              }catch( Throwable cause ) {
                cause.printStackTrace();
              }
          }
         });
         paste_ed2k_links = new JMenuItem("Paste ed2k link(s)");
         paste_ed2k_links.setIcon(ImgRep.getIcon("ed2k_link_paste.png"));
         paste_ed2k_links.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent event) {
                  (new JMThread(new JMRunnable() {
                     public void JMRun() {
                     try
                       Object clipboard_contents = clipboard.getData(DataFlavor.stringFlavor);
                       List<ED2KFileLink> clipboard_file_links = ED2KFileLink.extractLinks(clipboard_contents.toString());
                     if( clipboard_file_links.size() != 0
                     for(ED2KFileLink file_link : clipboard_file_links) { 
                                          _download_manager.addDownload(file_link);
                      }
                     }catch(Throwable t) {
                       t.printStackTrace();
                     }
                   }
                  })).start();
             }
           });
         copy_ed2k_links = new JMenuItem("Copy ed2k link(s)");
         copy_ed2k_links.setIcon(ImgRep.getIcon("ed2k_link.png"));
         copy_ed2k_links.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            clipboard.setContents(new Transferable() {
              public Object getTransferData(DataFlavor flavor)
                  throws UnsupportedFlavorException,
                  IOException {
                String ed2k_links = "";
                DownloadSession[] download_sessions = getSelectedDownloadSessions();
                for(DownloadSession session : download_sessions) {
                  ed2k_links += session.getED2KLink().getAsString() + System.getProperty("line.separator");
                }
                return ed2k_links;
              }

              public DataFlavor[] getTransferDataFlavors() {
                DataFlavor[] data_flavours = new DataFlavor[1];
                data_flavours[0] = DataFlavor.stringFlavor;
                return data_flavours;
              }

              public boolean isDataFlavorSupported(
                  DataFlavor flavor) {
                  return flavor.isFlavorTextType();
              }
             
            }, new ClipboardOwner() {

              public void lostOwnership(Clipboard clipboard, Transferable contents) {
               
              }
             
            });
          }
         });
         column_setup = new JMenuItem("Column setup");
         column_setup.setIcon(ImgRep.getIcon("columns_setup.png"));
         column_setup.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            System.out.println("Column setup performed");
          }
         });
         properties = new JMenuItem("Properties");
         properties.setIcon(ImgRep.getIcon("info.png"));
         properties.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            DownloadSession sessions[] = getSelectedDownloadSessions();
            DownloadDetailsDialog ddd = new DownloadDetailsDialog(parent, sessions[0]);
View Full Code Here

TOP

Related Classes of javax.swing.JMenuItem$AccessibleJMenuItem

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.