Package javax.swing

Examples of javax.swing.JRadioButtonMenuItem


    }
    else {
      buttonText = date.toString();
    }

    JRadioButtonMenuItem item = new JRadioButtonMenuItem(buttonText);

    if(MainFrame.getInstance().getProgramTableModel().getDate().equals(date)) {
      item.setFont(item.getFont().deriveFont(Font.BOLD));
    }

    item.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        MainFrame.getInstance().goTo(date);
      }
    });
    return item;
View Full Code Here


  public void updateChannelGroupMenu(JMenu menu) {
    menu.removeAll();
    String channelFilterName = Settings.propLastUsedChannelGroup.getString();
    // all channels
    JRadioButtonMenuItem menuItem = new JRadioButtonMenuItem(mLocalizer.msg(
        "channelGroupAll", "All channels"));
    menuItem.setSelected(channelFilterName == null);
    menuItem.addActionListener(new ActionListener() {

      public void actionPerformed(ActionEvent e) {
        MainFrame.getInstance().setChannelGroup(null);
      }
    });
    // selective groups
    menu.add(menuItem);
    String[] channelFilterNames = FilterComponentList.getInstance()
        .getChannelFilterNames();
    for (final String filterName : channelFilterNames) {
      menuItem = new JRadioButtonMenuItem(filterName);
      menuItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
          MainFrame.getInstance().setChannelGroup(
              (ChannelFilterComponent) FilterComponentList.getInstance()
                  .getFilterComponentByName(filterName));
        }
      });
      menu.add(menuItem);
      if (channelFilterName != null && filterName.equals(channelFilterName)) {
        menuItem.setSelected(true);
      }
    }
    menu.add(new JSeparator());
    // new channel group
    JMenuItem menuItemAdd = createMenuItem("channelGroupNew",
View Full Code Here

    FilterList filterList = FilterList.getInstance();
    ProgramFilter[] filterArr = filterList.getFilterArr();
    JRadioButtonMenuItem[] result = new JRadioButtonMenuItem[filterArr.length];
    for (int i = 0; i < filterArr.length; i++) {
      final ProgramFilter filter = filterArr[i];
      result[i] = new JRadioButtonMenuItem(filter.toString());
      final JRadioButtonMenuItem item = result[i];
      group.add(item);
      result[i].addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
          mMainFrame.setProgramFilter(filter);
          item.setSelected(true);
        }
      });
    }
    result[0].setSelected(true);
    return result;
View Full Code Here

    if (!(mSource instanceof ChannelsSettingsTab)) {
      mMenu.add(mFilterChannels);
      mMenu.addSeparator();
      mMenu.add(mChAdd);
      JMenu configureLayout = new JMenu(mLocalizer.msg("layout", "Layout"));
      layoutBoth = new JRadioButtonMenuItem(mLocalizer.msg("layoutBoth",
          "Logo and name"));
      layoutLogo = new JRadioButtonMenuItem(mLocalizer
          .msg("layoutLogo", "Logo"));
      layoutName = new JRadioButtonMenuItem(mLocalizer
          .msg("layoutName", "Name"));
      configureLayout.add(layoutBoth);
      configureLayout.add(layoutLogo);
      configureLayout.add(layoutName);
      mMenu.add(configureLayout);
View Full Code Here

            Settings.propShowChannelNamesInProgramTable.setBoolean(showNames);
            Settings.propShowChannelIconsInProgramTable.setBoolean(showIcons);
            MainFrame.getInstance().getProgramTableScrollPane().updateChannelPanel();
          }
        } else {
          JRadioButtonMenuItem filterItem = (JRadioButtonMenuItem) e
              .getSource();
          String filterName = filterItem.getText();
          final FilterComponent component = FilterComponentList.getInstance()
              .getFilterComponentByName(filterName);
          if (component != null && component instanceof ChannelFilterComponent) {
            setChannelGroup((ChannelFilterComponent) component);
          } else {
View Full Code Here

    }

    public void configure(List loaders) {
        removeAll();
        JRadioButtonMenuItem rb;
        ButtonGroup group = new ButtonGroup();

        for (Iterator it = loaders.iterator(); it.hasNext();) {
            Object obj = it.next();
            if (obj instanceof ProjectionLoader) {
                ProjectionLoader pl = (ProjectionLoader) obj;

                rb = new JRadioButtonMenuItem(pl.getPrettyName());
                rb.setActionCommand(projCmd);
                String plclassname = pl.getProjectionClass().getName();
                rb.setName(plclassname);
                rb.setToolTipText(pl.getDescription());
                rb.addActionListener(this);
                group.add(rb);
                add(rb);
            }
        }
View Full Code Here

        Debug.message("projectionmenu", "ProjectionMenu.actionPerformed(): "
                + command);

        if (command == projCmd) {
            JRadioButtonMenuItem rb = (JRadioButtonMenuItem) (ae.getSource());
            String projclassname = rb.getName();
            Debug.message("projectionmenu", "ProjectionMenu new proj name: "
                    + projclassname);
            try {
                Projection newProj = ProjectionFactory.makeProjection(projclassname,
                        projection);
                fireProjectionChanged(newProj);
            } catch (ProjectionException pe) {
                rb.setEnabled(false);
            }
        }
    }
View Full Code Here

                    }
                }
            };

            ButtonGroup group = new ButtonGroup();
            JRadioButtonMenuItem button = new JRadioButtonMenuItem(i18n.get(DrawingAttributes.class,
                    "Great_Circle",
                    "Great Circle"), lineType == LineType.GreatCircle);
            button.setActionCommand(String.valueOf(LineType.GreatCircle));
            button.addActionListener(listener);
            lineTypeMenu.add(button);

            button = new JRadioButtonMenuItem(i18n.get(GraphicAttributes.class,
                    "Rhumb",
                    "Rhumb"), lineType == LineType.Rhumb);
            button.setActionCommand(String.valueOf(LineType.Rhumb));
            group.add(button);
            button.addActionListener(listener);
            lineTypeMenu.add(button);

            button = new JRadioButtonMenuItem(i18n.get(GraphicAttributes.class,
                    "Straight",
                    "Straight"), lineType == LineType.Straight);
            button.setActionCommand(String.valueOf(LineType.Straight));
            group.add(button);
            button.addActionListener(listener);
            lineTypeMenu.add(button);
        }
        return lineTypeMenu;
    }
View Full Code Here

                }
            }
        };

        ButtonGroup group = new ButtonGroup();
        JRadioButtonMenuItem button = new JRadioButtonMenuItem(i18n.get(BasicStrokeEditorMenu.class, "Butt", "Butt"), endCaps == BasicStroke.CAP_BUTT);
        button.setActionCommand(String.valueOf(BasicStroke.CAP_BUTT));
        group.add(button);
        button.addActionListener(listener);
        capMenu.add(button);

        button = new JRadioButtonMenuItem(i18n.get(BasicStrokeEditorMenu.class, "Round", "Round"), endCaps == BasicStroke.CAP_ROUND);
        button.setActionCommand(String.valueOf(BasicStroke.CAP_ROUND));
        group.add(button);
        button.addActionListener(listener);
        capMenu.add(button);

        button = new JRadioButtonMenuItem(i18n.get(BasicStrokeEditorMenu.class, "Square", "Square"), endCaps == BasicStroke.CAP_SQUARE);
        button.setActionCommand(String.valueOf(BasicStroke.CAP_SQUARE));
        group.add(button);
        button.addActionListener(listener);
        capMenu.add(button);

        //////// Line Joins

        JMenu joinMenu = new JMenu(i18n.get(BasicStrokeEditorMenu.class, "Joint_Decoration", "Joint Decoration"));

        listener = new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
                String command = ae.getActionCommand();
                try {
                    setLineJoins(Integer.parseInt(command));
                    resetStroke();
                } catch (NumberFormatException e) {
                }
            }
        };

        group = new ButtonGroup();
        button = new JRadioButtonMenuItem(i18n.get(BasicStrokeEditorMenu.class, "Miter", "Miter"), lineJoins == BasicStroke.JOIN_MITER);
        button.setActionCommand(String.valueOf(BasicStroke.JOIN_MITER));
        group.add(button);
        button.addActionListener(listener);
        joinMenu.add(button);

        button = new JRadioButtonMenuItem(i18n.get(BasicStrokeEditorMenu.class, "Round", "Round"), lineJoins == BasicStroke.JOIN_ROUND);
        button.setActionCommand(String.valueOf(BasicStroke.JOIN_ROUND));
        group.add(button);
        button.addActionListener(listener);
        joinMenu.add(button);

        button = new JRadioButtonMenuItem(i18n.get(BasicStrokeEditorMenu.class, "Bevel", "Bevel"), lineJoins == BasicStroke.JOIN_BEVEL);
        button.setActionCommand(String.valueOf(BasicStroke.JOIN_BEVEL));
        group.add(button);
        button.addActionListener(listener);
        joinMenu.add(button);

        //////// Line Width

        JMenu widthMenu = new JMenu(i18n.get(BasicStrokeEditorMenu.class, "Line_Width", "Line_Width"));

        listener = new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
                String command = ae.getActionCommand();
                try {
                    setStrokeWidth((float) Integer.parseInt(command));
                    resetStroke();
                } catch (NumberFormatException e) {
                }
            }
        };

        group = new ButtonGroup();
        ImageIcon ii;
        int i;
        for (i = 1; i < 13; i++) {
            ii = createIcon(new BasicStroke(i), 50, 20, true);
            button = new JRadioButtonMenuItem(" ", ii, (int) width == i);//without the space as a parameter these instances look strange with some Look&Feel
            button.setActionCommand(String.valueOf(i));
            group.add(button);
            button.addActionListener(listener);
            button.setMargin( new java.awt.Insets(0,10,0,10));
            button.setPreferredSize(new java.awt.Dimension(70,20));
            widthMenu.add(button);
        }

        //////// Dash Pattern

        JMenu dashMenu = new JMenu(i18n.get(BasicStrokeEditorMenu.class, "Dash_Pattern", "Dash Pattern"));

        listener = new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
                String command = ae.getActionCommand();
                try {
                    setDash(stringToDashArray(command));
                    resetStroke();
                } catch (NumberFormatException e) {
                }
            }
        };

        group = new ButtonGroup();

        String[] patterns = new String[] { NONE, "1.0 3.0", "3.0 3.0", "12.0 10.0",
                "12.0 10.0 6.0 10.0", "20.0 10.0", "20.0 10.0 6.0 10.0", "20.0 10.0 6.0 10.0 6.0 10.0" };

        String currentDash = dashArrayToString(getDash());
        for (i = 0; i < patterns.length; i++) {
            BasicStroke dashStroke = new BasicStroke(1.0f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER, 10.0f, stringToDashArray(patterns[i]), 0.0f);
            ii = createIcon(dashStroke, 90, 10, true);

            button = new JRadioButtonMenuItem(" ", ii, currentDash.equals(patterns[i]));
            button.setActionCommand(patterns[i]);
            group.add(button);
            button.addActionListener(listener);
            button.setMargin( new java.awt.Insets(0,10,0,10));
            button.setPreferredSize(new java.awt.Dimension(110,20));
            dashMenu.add(button);
        }

        popup.add(widthMenu);
        popup.add(dashMenu);
View Full Code Here

           
            int descDir = -1; // this description direction

            ButtonGroup group = new ButtonGroup();
            ImageIcon ii = createArrowIcon(new BasicStroke(1), 50, 20, descDir);
            JRadioButtonMenuItem button = new JRadioButtonMenuItem(ii, !doArrowHead);
            button.setActionCommand(String.valueOf(descDir));
            group.add(button);
            button.addActionListener(listener);
            arrowheadMenu.add(button);

            for (descDir = OMArrowHead.ARROWHEAD_DIRECTION_FORWARD; descDir <= OMArrowHead.ARROWHEAD_DIRECTION_BOTH; descDir++) {
                ii = createArrowIcon(new BasicStroke(1), 50, 20, descDir);
                button = new JRadioButtonMenuItem(ii, doArrowHead
                        && currentDirection == descDir);
                button.setActionCommand(String.valueOf(descDir));
                group.add(button);
                button.addActionListener(listener);
                arrowheadMenu.add(button);
            }
        }
        return arrowheadMenu;
    }
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.