本文整理匯總了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;
}