Package org.pushingpixels.flamingo.api.common

Examples of org.pushingpixels.flamingo.api.common.JCommandToggleButton


                          deco) - 2, y + height - 2);
                }
                g2d.dispose();
              }
            });
        JCommandToggleButton jrb = new JCommandToggleButton(null,
            finalIcon);
        jrb.setName("Group " + groupIndex + ", index " + i);
        jrb.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            System.out.println("Invoked action on " + deco);
          }
        });
        this.addButtonToLastGroup(jrb);
View Full Code Here


public class TestCommandToggleButtonsNoIcon extends TestCommandToggleButtons {
  @Override
  protected JCommandToggleButton createToggleButton(
      CommandButtonDisplayState state, String title) {
    JCommandToggleButton mainButton = new JCommandToggleButton(title);
    mainButton
        .setExtraText(resourceBundle.getString("SelectAll.textExtra"));
    mainButton.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        System.out.println(stamp() + ": Main selection");
      }
    });
    mainButton.setDisplayState(state);
    mainButton.setFlat(false);
    return mainButton;
  }
View Full Code Here

  private static void apply(Container cont, Command cmd) {
    for (int i = 0; i < cont.getComponentCount(); i++) {
      Component comp = cont.getComponent(i);
      if (comp instanceof JCommandToggleButton) {
        JCommandToggleButton cb = (JCommandToggleButton) comp;
        cmd.apply(cb);
      }
      if (comp instanceof Container) {
        apply((Container) comp, cmd);
      }
View Full Code Here

public class TestCommandToggleButtonsNoText extends TestCommandToggleButtons {
  @Override
  protected JCommandToggleButton createToggleButton(
      CommandButtonDisplayState state, String title) {
    JCommandToggleButton mainButton = new JCommandToggleButton(
        new edit_paste());
    mainButton.setDisabledIcon(new FilteredResizableIcon(new edit_paste(),
        new ColorConvertOp(ColorSpace.getInstance(ColorSpace.CS_GRAY),
            null)));
    mainButton.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        System.out.println(stamp() + ": Main selection");
      }
    });
    mainButton.setDisplayState(state);
    mainButton.setFlat(false);
    return mainButton;
  }
View Full Code Here

  private static void apply(Container cont, Command cmd) {
    for (int i = 0; i < cont.getComponentCount(); i++) {
      Component comp = cont.getComponent(i);
      if (comp instanceof JCommandToggleButton) {
        JCommandToggleButton cb = (JCommandToggleButton) comp;
        cmd.apply(cb);
      }
      if (comp instanceof Container) {
        apply((Container) comp, cmd);
      }
View Full Code Here

  private void addButtons(DefaultFormBuilder builder,
      CommandButtonDisplayState state) {
    builder.append(state.getDisplayName() + " state");

    JCommandToggleButton buttonWithShortText = createToggleButton(state,
        resourceBundle.getString("Short.text"));
    builder.append(buttonWithShortText);
    JCommandToggleButton buttonWithLongText = createToggleButton(state,
        resourceBundle.getString("LongerLines.text"));
    builder.append(buttonWithLongText);
  }
View Full Code Here

    builder.append(buttonWithLongText);
  }

  protected JCommandToggleButton createToggleButton(
      CommandButtonDisplayState state, String title) {
    final JCommandToggleButton mainButton = new JCommandToggleButton(title,
        new edit_paste());
    mainButton.setDisabledIcon(new FilteredResizableIcon(new edit_paste(),
        new ColorConvertOp(ColorSpace.getInstance(ColorSpace.CS_GRAY),
            null)));
    mainButton
        .setExtraText(resourceBundle.getString("SelectAll.textExtra"));
    mainButton.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        System.out.println(stamp()
            + ": button activated, selection state is "
            + mainButton.getActionModel().isSelected());
      }
    });
    mainButton.setDisplayState(state);
    mainButton.setFlat(false);
    return mainButton;
  }
View Full Code Here

    super("Ribbon gallery check");

    this.buttons = new JCommandToggleButton[4][10];
    for (int i = 0; i < 4; i++) {
      for (int j = 0; j < 10; j++) {
        this.buttons[i][j] = new JCommandToggleButton("Button " + i
            + ":" + j, new DecoratedResizableIcon(
            new DisabledResizableIcon(RibbonElementPriority.TOP,
                32, 32), new TopLeftDecoration(i),
            new BottomRightDecoration(j)));
      }
    }

    this.ribbonBand = new JRibbonBand("Band", new EmptyResizableIcon(32));

    Map<RibbonElementPriority, Integer> visibleButtonCounts = new HashMap<RibbonElementPriority, Integer>();
    visibleButtonCounts.put(RibbonElementPriority.LOW, 4);
    visibleButtonCounts.put(RibbonElementPriority.MEDIUM, 5);
    visibleButtonCounts.put(RibbonElementPriority.TOP, 6);

    List<StringValuePair<List<JCommandToggleButton>>> galleryButtons = new ArrayList<StringValuePair<List<JCommandToggleButton>>>();
    for (int i = 0; i < 4; i++) {
      List<JCommandToggleButton> galleryButtonsList = new ArrayList<JCommandToggleButton>();
      for (int j = 0; j < 10; j++) {
        galleryButtonsList.add(this.buttons[i][j]);
      }
      galleryButtons.add(new StringValuePair<List<JCommandToggleButton>>(
          "Group " + i, galleryButtonsList));
    }

    this.ribbonBand.addRibbonGallery(GALLERY_NAME, galleryButtons,
        visibleButtonCounts, 6, 4, RibbonElementPriority.TOP);

    this.gallery = this.ribbonBand.getControlPanel().getRibbonGallery(
        GALLERY_NAME);

    this.getRibbon().addTask(new RibbonTask("Task 1", this.ribbonBand));

    JPanel controlPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    JButton addToGroup0 = new JButton("Add one to 0");
    addToGroup0.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
        JCommandToggleButton toAdd = new JCommandToggleButton(
            "Button 0 new", new DecoratedResizableIcon(
                new DisabledResizableIcon(
                    RibbonElementPriority.TOP, 32, 32),
                new TopLeftDecoration(0),
                new BottomRightDecoration(99)));
        ribbonBand.addRibbonGalleryButtons(GALLERY_NAME, "Group 0",
            toAdd);
      }
    });
    controlPanel.add(addToGroup0);

    JButton addToGroup2 = new JButton("Add two to 2");
    addToGroup2.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
        JCommandToggleButton toAdd = new JCommandToggleButton(
            "Button 2 new", new DecoratedResizableIcon(
                new DisabledResizableIcon(
                    RibbonElementPriority.TOP, 32, 32),
                new TopLeftDecoration(2),
                new BottomRightDecoration(99)));
        JCommandToggleButton toAdd2 = new JCommandToggleButton(
            "Button 2 new 2", new DecoratedResizableIcon(
                new DisabledResizableIcon(
                    RibbonElementPriority.TOP, 32, 32),
                new TopLeftDecoration(2),
                new BottomRightDecoration(66)));
View Full Code Here

        JRibbonBand findBand = new JRibbonBand("Find",
            new EmptyResizableIcon(32));
        findBand.setCollapsedStateKeyTip("ZY");

        findButton = new JCommandToggleButton("Find",
            new EmptyResizableIcon(32));
        findButton.getActionModel().setSelected(true);
        findBand
            .addCommandButton(findButton, RibbonElementPriority.TOP);

        replaceButton = new JCommandToggleButton("Replace",
            new EmptyResizableIcon(32));
        replaceButton.getActionModel().setSelected(true);
        findBand.addCommandButton(replaceButton,
            RibbonElementPriority.MEDIUM);

        findReplaceButton = new JCommandToggleButton("Find replace",
            new EmptyResizableIcon(32));
        findReplaceButton.getActionModel().setSelected(true);
        findBand.addCommandButton(findReplaceButton,
            RibbonElementPriority.MEDIUM);

        selectAllButton = new JCommandToggleButton("Select all",
            new EmptyResizableIcon(32));
        selectAllButton.getActionModel().setSelected(true);
        findBand.addCommandButton(selectAllButton,
            RibbonElementPriority.MEDIUM);
View Full Code Here

 
  public static JCommandToggleButton createCommandToggleButton(final AFreeplaneAction action) {
    String title = ActionUtils.getActionTitle(action);
    ResizableIcon icon = ActionUtils.getActionIcon(action);
   
    final JCommandToggleButton button = new JCommandToggleButton(title, icon);
   
    updateRichTooltip(button, action, null);
    button.addActionListener(new RibbonActionListener(action));
    button.setFocusable(false);
    return button;
  }
View Full Code Here

TOP

Related Classes of org.pushingpixels.flamingo.api.common.JCommandToggleButton

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.