本文整理汇总了Java中javafx.scene.control.Menu.getItems方法的典型用法代码示例。如果您正苦于以下问题:Java Menu.getItems方法的具体用法?Java Menu.getItems怎么用?Java Menu.getItems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.Menu
的用法示例。
在下文中一共展示了Menu.getItems方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fillContextMenu
import javafx.scene.control.Menu; //导入方法依赖的package包/类
@Override
@FXThread
public void fillContextMenu(@NotNull final NodeTree<?> nodeTree, @NotNull final ObservableList<MenuItem> items) {
final Toneg0dParticleInfluencers element = getElement();
final ParticleEmitterNode emitterNode = element.getEmitterNode();
final Menu createMenu = new Menu(Messages.MODEL_NODE_TREE_ACTION_CREATE, new ImageView(Icons.ADD_12));
final ObservableList<MenuItem> createItems = createMenu.getItems();
CONSTRUCTORS.forEach((type, constructor) -> {
if (emitterNode.getInfluencer(type) != null) return;
createItems.add(newInstance(constructor, nodeTree, this));
});
items.add(createMenu);
super.fillContextMenu(nodeTree, items);
}
示例2: getChidernMenuItem
import javafx.scene.control.Menu; //导入方法依赖的package包/类
private void getChidernMenuItem(Menu parentMenu, String items, List<MenuItem> menuItems) {
ObservableList<MenuItem> children = parentMenu.getItems();
for (MenuItem menuItem : children) {
if (menuItem instanceof Menu) {
getChidernMenuItem((Menu) menuItem, items, menuItems);
}
if (!(menuItem instanceof SeparatorMenuItem) && getTextForMenuItem(menuItem, menuItem.getParentMenu()).equals(items)) {
menuItems.add(menuItem);
break;
}
}
}
示例3: search
import javafx.scene.control.Menu; //导入方法依赖的package包/类
/**
* 搜索子菜单
*
* @param uiPlatform
* @param menu
*/
private void search(UIPlatform uiPlatform, Menu menu)
{
ObservableList<MenuItem> list = menu.getItems();
if (list.size() == 0)
{
return;
}
final String idPrefix = getPrefix().idPrefix;
final String pathPrefix = getPrefix().pathPrefix;
IdDeal idDeal = uiPlatform.getIdDeal();
BinderFactory factory = uiPlatform.getBinderFactory();
for (int i = 0; i < list.size(); i++)
{
MenuItem menuItem = list.get(i);
UiId id = UiId.newInstance(menuItem.getId(), idPrefix);
if (id != null)
{
IdDeal.Result result = idDeal.dealId(id, pathPrefix);
if (result != null)
{
hashMap.put(id, factory.getBinder(menuItem));
}
}
if (menuItem instanceof Menu)
{
search(uiPlatform, (Menu) menuItem);
}
}
}
示例4: getMenuItem
import javafx.scene.control.Menu; //导入方法依赖的package包/类
/**
* get the menu item with the given id
*
* @param id
* @return the menu item
*/
public MenuItem getMenuItem(String id) {
if (this.getMenuBar() != null)
for (Menu menu : this.getMenuBar().getMenus()) {
for (MenuItem menuItem : menu.getItems()) {
if (id.equals(menuItem.getId())) {
return menuItem;
}
}
}
return null;
}
示例5: fillContextMenu
import javafx.scene.control.Menu; //导入方法依赖的package包/类
@Override
public void fillContextMenu(@NotNull final NodeTree<?> nodeTree,
@NotNull final ObservableList<MenuItem> items) {
if (!(nodeTree instanceof ModelNodeTree)) return;
final Menu changeMeshMenu = new Menu(Messages.MODEL_NODE_TREE_ACTION_PARTICLE_EMITTER_CHANGE_PARTICLES_MESH, new ImageView(Icons.MESH_16));
final ObservableList<MenuItem> subItems = changeMeshMenu.getItems();
subItems.add(new CreateQuadParticleMeshAction(nodeTree, this));
subItems.add(new CreatePointParticleMeshAction(nodeTree, this));
subItems.add(new CreateImpostorParticleMeshAction(nodeTree, this));
subItems.add(new LoadModelParticlesMeshAction(nodeTree, this));
final Menu jmePrimitivesMenu = new Menu(Messages.MODEL_NODE_TREE_ACTION_CREATE_PRIMITIVE, new ImageView(Icons.GEOMETRY_16));
final ObservableList<MenuItem> primitivesItems = jmePrimitivesMenu.getItems();
primitivesItems.add(new CreateBoxShapeEmitterAction(nodeTree, this));
primitivesItems.add(new CreateCylinderShapeEmitterAction(nodeTree, this));
primitivesItems.add(new CreateDomeShapeEmitterAction(nodeTree, this));
primitivesItems.add(new CreateQuadShapeEmitterAction(nodeTree, this));
primitivesItems.add(new CreateSphereShapeEmitterAction(nodeTree, this));
primitivesItems.add(new CreateTorusShapeEmitterAction(nodeTree, this));
final Menu changeShapeMenu = new Menu(Messages.MODEL_NODE_TREE_ACTION_PARTICLE_EMITTER_CHANGE_SHAPE, new ImageView(Icons.GEOMETRY_16));
changeShapeMenu.getItems().addAll(new CreateTriangleShapeEmitterAction(nodeTree, this),
jmePrimitivesMenu,
new LoadModelShapeEmitterAction(nodeTree, this));
items.add(changeShapeMenu);
items.add(changeMeshMenu);
super.fillContextMenu(nodeTree, items);
}
示例6: createCreationMenu
import javafx.scene.control.Menu; //导入方法依赖的package包/类
/**
* Create creation menu menu.
*
* @param nodeTree the node tree
* @return the menu
*/
@FXThread
protected @Nullable Menu createCreationMenu(@NotNull final NodeTree<?> nodeTree) {
final T element = getElement();
final Menu menu = new Menu(MODEL_NODE_TREE_ACTION_CREATE, new ImageView(Icons.ADD_12));
final Menu createControlsMenu = new Menu(MODEL_NODE_TREE_ACTION_ADD_CONTROL, new ImageView(Icons.ADD_12));
final ObservableList<MenuItem> items = createControlsMenu.getItems();
items.add(new CreateCustomControlAction(nodeTree, this));
if (element.getControl(RigidBodyControl.class) == null) {
items.add(new CreateStaticRigidBodyControlAction(nodeTree, this));
items.add(new CreateRigidBodyControlAction(nodeTree, this));
}
if (element.getControl(VehicleControl.class) == null) {
items.add(new CreateVehicleControlAction(nodeTree, this));
}
if (element.getControl(CharacterControl.class) == null) {
items.add(new CreateCharacterControlAction(nodeTree, this));
}
if (element.getControl(MotionEvent.class) == null) {
items.add(new CreateMotionControlAction(nodeTree, this));
}
items.add(new CreateLightControlAction(nodeTree, this));
//final SkeletonControl skeletonControl = element.getControl(SkeletonControl.class);
//if (skeletonControl != null) {
//FIXME items.add(new CreateKinematicRagdollControlAction(nodeTree, this));
//}
menu.getItems().add(createControlsMenu);
return menu;
}