use of org.freeplane.core.ui.components.JFreeplaneMenuItem in project freeplane by freeplane.
the class ColorProperty method layout.
public void layout(final DefaultFormBuilder builder) {
layout(builder, mButton);
final JMenuItem item = new JFreeplaneMenuItem(TextUtils.getOptionalText("ColorProperty.ResetColor"));
item.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
setValue(defaultColor);
}
});
menu.add(item);
mButton.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(final MouseEvent evt) {
if (evt.isPopupTrigger()) {
menu.show(evt.getComponent(), evt.getX(), evt.getY());
}
}
@Override
public void mouseReleased(final MouseEvent evt) {
if (evt.isPopupTrigger()) {
menu.show(evt.getComponent(), evt.getX(), evt.getY());
}
}
});
}
use of org.freeplane.core.ui.components.JFreeplaneMenuItem in project freeplane by freeplane.
the class MenuActionComponentProvider method createComponent.
/* (non-Javadoc)
* @see org.freeplane.core.ui.menubuilders.menu.ComponentProvider#createComponent(org.freeplane.core.ui.menubuilders.generic.Entry)
*/
@Override
public Component createComponent(Entry entry) {
final AFreeplaneAction action = entryAccessor.getAction(entry);
if (action != null) {
final JMenuItem actionComponent;
IFreeplaneAction wrappedAction = acceleratebleActionProvider.wrap(action);
if (action.isSelectable()) {
actionComponent = new JAutoCheckBoxMenuItem(wrappedAction);
} else {
actionComponent = new JFreeplaneMenuItem(wrappedAction);
}
final KeyStroke accelerator = accelerators.getAccelerator(action);
actionComponent.setAccelerator(accelerator);
MenuIconScaling.scaleIcon(actionComponent);
return actionComponent;
} else if (entry.builders().contains("separator")) {
return new JPopupMenu.Separator();
} else
return null;
}
use of org.freeplane.core.ui.components.JFreeplaneMenuItem in project freeplane by freeplane.
the class EmptyMenuItemBuilder method visit.
@Override
public void visit(Entry target) {
final Container container = getMenuItemContainer(target);
if (container.getComponentCount() == 0) {
final String text = TextUtils.getText(target.getParent().getName() + ".noActions");
final JFreeplaneMenuItem noActionItem = new JFreeplaneMenuItem(text);
noActionItem.setEnabled(false);
entryAccessor.setComponent(target, noActionItem);
container.add(noActionItem);
}
}
Aggregations