/** {@inheritDoc} */
  protected void frameInit() {
    super.frameInit();

    setDefaultCloseOperation(EXIT_ON_CLOSE);

    JToolBar tb = new JToolBar();
    tb.add(new SetLabelTextAction("ToolBar"));

    JXPopupMenu popup = new JXPopupMenu("", 5);
    popup.add(new SetLabelTextAction("Std Action"));

    SetLabelTextAction sea = new SetLabelTextAction("CheckBox 1");
    sea.setStateAction();
    popup.add(sea);

    sea = new SetLabelTextAction("CheckBox 2");
    sea.setStateAction();
    sea.setSelected(true);
    popup.add(sea);

    JMenu submenu = new JXMenu("Submenu");
    submenu.add(new SetLabelTextAction("Aaa"));
    submenu.add(new SetLabelTextAction("Bbb"));
    submenu.add(new SetLabelTextAction("Ccc"));
    submenu.add(new SetLabelTextAction("Ddd"));
    submenu.add(new SetLabelTextAction("Eee"));
    submenu.add(new SetLabelTextAction("Fff"));
    submenu.add(new SetLabelTextAction("Ggg"));
    popup.add(submenu);

    //        popup.addSeparator();

    sea = new SetLabelTextAction("Radio 1");
    sea.setStateAction();
    sea.setGroup("group1");
    popup.add(sea);

    sea = new SetLabelTextAction("Radio 2");
    sea.setStateAction();
    sea.setGroup("group1");
    sea.setSelected(true);
    popup.add(sea);

    //        popup.addSeparator();

    sea = new SetLabelTextAction("Group 2 - 1");
    sea.setStateAction();
    sea.setGroup("group2");
    sea.setSelected(true);
    popup.add(sea);

    sea = new SetLabelTextAction("Group 2 - 2");
    sea.setStateAction();
    sea.setGroup("group2");
    popup.add(sea);

    tb.setComponentPopupMenu(popup);

    setToolBar(tb);

    label = new JLabel();
    label.setHorizontalAlignment(JLabel.CENTER);
    add(label);
  }
Beispiel #2
0
 public ToolbarPreferences() {
   control.setFloatable(false);
   control.setComponentPopupMenu(popupMenu);
 }