Package javax.swing

Examples of javax.swing.JRadioButtonMenuItem


    exit = new JMenuItem();
    new_downloads = new JMenuItem();
    new_servers = new JMenuItem();
    import_server_list = new JMenuItem();
    ButtonGroup radio_button_menu_items_group = new ButtonGroup();
    servers = new JRadioButtonMenuItem();
    transfers = new JRadioButtonMenuItem();
    search = new JRadioButtonMenuItem();
    shared_files = new JRadioButtonMenuItem();
    stats = new JRadioButtonMenuItem();
    logs = new JRadioButtonMenuItem();
    radio_button_menu_items_group.add(servers);
    radio_button_menu_items_group.add(transfers);
    radio_button_menu_items_group.add(search);
    radio_button_menu_items_group.add(shared_files);
    radio_button_menu_items_group.add(stats);
View Full Code Here


                                         boolean popup,
                                         JToggleButton.ToggleButtonModel toggleButtonModel,
                                         boolean radioButton) {
    JMenuItem menuItem;
    if (radioButton) {
      menuItem = new JRadioButtonMenuItem();
    } else {
      menuItem = new JCheckBoxMenuItem();
    }
    // Configure model
    menuItem.setModel(toggleButtonModel);
View Full Code Here

    // Add radio button menu items to sub menu and make them share the same radio button group
    ButtonGroup sortButtonGroup = new ButtonGroup();
    for (Map.Entry<HomePieceOfFurniture.SortableProperty, Action> entry : sortActions.entrySet()) {
      final HomePieceOfFurniture.SortableProperty furnitureProperty = entry.getKey();
      Action sortAction = entry.getValue();
      JRadioButtonMenuItem sortMenuItem = new JRadioButtonMenuItem();
      // Use a special model for sort radio button menu item that is selected if
      // home is sorted on furnitureProperty criterion
      sortMenuItem.setModel(new JToggleButton.ToggleButtonModel() {
          @Override
          public boolean isSelected() {
            return furnitureProperty == home.getFurnitureSortedProperty();
          }
        });
      // Configure check box menu item action after setting its model to avoid losing its mnemonic
      sortMenuItem.setAction(new ResourceAction.MenuItemAction(sortAction));
      sortMenu.add(sortMenuItem);
      sortButtonGroup.add(sortMenuItem);
    }
    Action sortOrderAction = getActionMap().get(ActionType.SORT_HOME_FURNITURE_BY_DESCENDING_ORDER);
    if (sortOrderAction.getValue(Action.NAME) != null) {
View Full Code Here

        rbAllSchemas.setSelected(schemaFilter == null);
        group.add(rbAllSchemas);
        mnuSchemas.add(rbAllSchemas);

        String               s;
        JRadioButtonMenuItem radioButton;

        for (int i = 0; i < list.size(); i++) {
            s           = (String) list.get(i);
            radioButton = new JRadioButtonMenuItem(s);

            group.add(radioButton);
            mnuSchemas.add(radioButton);
            radioButton.setSelected(schemaFilter != null
                                    && schemaFilter.equals(s));
            radioButton.addActionListener(schemaListListener);
            radioButton.setEnabled(list.size() > 1);
        }

        mnuSchemas.addSeparator();
        mnuSchemas.add(mitemUpdateSchemas);
    }
View Full Code Here

    // Create menu
    for (int i=0;  i<classes.size(); i++) {
      String className  = (String)classes.elementAt(i);
      String name       = (String)names.elementAt(i);
      JRadioButtonMenuItem rbMenuItem =
  (JRadioButtonMenuItem) add( new JRadioButtonMenuItem( name ) );
      rbMenuItem.setActionCommand( className );

      /*
      rbMenuItem.setAccelerator
  ( KeyStroke.getKeyStroke( KeyEvent.VK_0+ i, ActionEvent.ALT_MASK ) );
      */

      rbMenuItem.getAccessibleContext().setAccessibleDescription
  ("The look and feel option for '"+name+"'.");
      rbMenuItem.setSelected( name.equals( currentLFName ) );
      rbMenuItem.addItemListener( this );

      lfGroup.add( rbMenuItem );
    }

  }//LookAndFeelMenu
View Full Code Here

    if (root!=null) {
      root.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    }
    */

    final JRadioButtonMenuItem rb   = (JRadioButtonMenuItem) e.getSource();
    final String newLFClassName     = rb.getActionCommand();
    final String newLFName          = rb.getText();
    final String currentLFClassName = UIManager.getLookAndFeel().getName();


    LookAndFeel cLF = (LookAndFeel)lfManager.customLF.get(newLFClassName);

    if(cLF != null) {     // First, check if it any of the custom LFs
      try {

 
  Activator.log.debug("set custom LF classloader to" + cLF.getClass().getClassLoader());
  UIManager.getLookAndFeelDefaults().put("ClassLoader", cLF.getClass().getClassLoader());

  Activator.log.debug("set custom LF " + newLFClassName);
  UIManager.setLookAndFeel(cLF);
 
  for(Iterator it = roots.iterator(); it.hasNext();) {
    Component root = (Component)it.next();
    SwingUtilities.updateComponentTreeUI( root );
  }

      } catch (Exception ex) {
  Activator.log.error("Failed to set LF " + newLFClassName, ex);
      }
    } else // Otherwise, go for one of the installed LFs
      if (newLFClassName!=null && !newLFClassName.equals(currentLFClassName)) {
  try {
    Activator.log.debug("set installed LF " + newLFClassName);
    UIManager.setLookAndFeel(newLFClassName);
    try {
      for(Iterator it = roots.iterator(); it.hasNext();) {
        Component root = (Component)it.next();
        SwingUtilities.updateComponentTreeUI( root );
      }

    } catch (NullPointerException npe) {
      Activator.log.error
        ( "Unexpected error while applying new look and feel", npe);
    }
  } catch (UnsupportedLookAndFeelException exc) {
    rb.setEnabled( false );
    Activator.log.error( "Unsupported LookAndFeel: " + newLFName
             +" ("+newLFClassName+")", exc );
   
    // Fallback: Set L&F to cross platform L&F
    Activator.log.error( "Reverting to the cross platform LookAndFeel." );
    final String cpLFcn = UIManager.getCrossPlatformLookAndFeelClassName();
    // Find the menu item with the cross platform L&F and select it
    for (Enumeration lfBEnum = lfGroup.getElements();
         lfBEnum.hasMoreElements(); ) {
      final AbstractButton ab =(AbstractButton)lfBEnum.nextElement();
      if (cpLFcn.equals( ab.getActionCommand() )) {
        SwingUtilities.invokeLater( new Runnable(){
      public void run() { ab.setSelected(true); }} );
        break;
      }
    }
  } catch (Exception exc) {
    rb.setEnabled(false);
    Activator.log.error("Could not load LookAndFeel: " +rb.getText(), exc);
  }
      } else {
  // Selected current LF, noop
      }
    }
View Full Code Here

  }

  void bundlePanelShowTab(ServiceReference sr) {
    final String key = (String)sr.getProperty(SwingBundleDisplayer.PROP_NAME);
    bundlePanel.showTab(key);
    final JRadioButtonMenuItem item = (JRadioButtonMenuItem) menuMap.get(sr);
    if (null!=item) {
      item.setSelected(true);
    }
  }
View Full Code Here

          add(levelMenuLabel = new JMenuItem(Strings.get("startlevel.noSel")));
          add(new JSeparator());

          for(int i = levelMin; i <= levelMax; i++) {
            final AbstractButton jrb = new JRadioButtonMenuItem(Integer.toString(i));
            group.add(jrb);
            add(jrb);
            jrb.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent ev) {
                  final StartLevel sls = (StartLevel)slTracker.getService();

                  final Bundle[] bl = getSelectedBundles();

                  if(null != sls) {
                    final int level = Integer.parseInt(jrb.getText());
                    for (int i=0; i<bl.length; i++) {
                      sls.setBundleStartLevel(bl[i], level);
                    }
                    updateBundleViewSelections();
                  }
View Full Code Here

    for(Iterator it = displayMap.keySet().iterator(); it.hasNext(); ) {
      final ServiceReference     sr   = (ServiceReference)it.next();
      final String   name = (String)sr.getProperty(SwingBundleDisplayer.PROP_NAME);
      final int c2 = count++;

      menu.add(new JRadioButtonMenuItem(name) {
          {
            setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_1 + c2,
                                                  mask));
            setMnemonic(KeyEvent.VK_1 + c2);
            menuMap.put(sr, this);
View Full Code Here

        });
        edlMenu = new JMenu(Strings.get("menu_errordialoglevel")) {
          {
            ButtonGroup group = new ButtonGroup();

            AbstractButton jrbn = new JRadioButtonMenuItem(Strings.get("menu_errordialoglevel_normal"));
            group.add(jrbn);
            add(jrbn);
            jrbn.addActionListener(new ActionListener() {
              public void actionPerformed(ActionEvent ev) {
                System.setProperty("org.knopflerfish.desktop.errordialogfriendliness", "normal");
              }
            });

            AbstractButton jrbm = new JRadioButtonMenuItem(Strings.get("menu_errordialoglevel_more"));
            group.add(jrbm);
            add(jrbm);
            jrbm.addActionListener(new ActionListener() {
              public void actionPerformed(ActionEvent ev) {
                System.setProperty("org.knopflerfish.desktop.errordialogfriendliness", "more");
              }
            });

            AbstractButton jrba = new JRadioButtonMenuItem(Strings.get("menu_errordialoglevel_advanced"));
            group.add(jrba);
            add(jrba);
            jrba.addActionListener(new ActionListener() {
              public void actionPerformed(ActionEvent ev) {
                System.setProperty("org.knopflerfish.desktop.errordialogfriendliness", "advanced");
              }
            });

            String curr = Util.getProperty("org.knopflerfish.desktop.errordialogfriendliness", null);
            if ("more".equals(curr)) {
              group.setSelected(jrbm.getModel(), true);
            } else if ("advanced".equals(curr)) {
              group.setSelected(jrba.getModel(), true);
            } else {
              group.setSelected(jrbn.getModel(), true);
            }

            setEnabled(!Util.getBooleanProperty("org.knopflerfish.desktop.dontuseerrordialog", false));
View Full Code Here

TOP

Related Classes of javax.swing.JRadioButtonMenuItem

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.