本文整理汇总了Java中com.kotcrab.vis.ui.widget.Menu类的典型用法代码示例。如果您正苦于以下问题:Java Menu类的具体用法?Java Menu怎么用?Java Menu使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Menu类属于com.kotcrab.vis.ui.widget包,在下文中一共展示了Menu类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initMenuBar
import com.kotcrab.vis.ui.widget.Menu; //导入依赖的package包/类
private void initMenuBar() {
menuBar = new MenuBar();
Menu fileMenu = new Menu("File");
MenuItem editorItem = new MenuItem("Open Editor", new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
SwingUtilities.invokeLater(() -> openEditor());
}
});
editorItem.setShortcut(requiredModifier, keyCode);
fileMenu.addItem(editorItem);
menuBar.addMenu(fileMenu);
uiGroup().addActor(menuBar.getTable());
}
示例2: addChild
import com.kotcrab.vis.ui.widget.Menu; //导入依赖的package包/类
@Override
protected void addChild(final Actor actor) {
if (actor instanceof Menu) {
menuBar.addMenu((Menu) actor);
} else {
getParser().throwErrorIfStrict("Menu bars can handle only menu children. Found child: " + actor);
super.addChild(actor);
}
}
示例3: postInit
import com.kotcrab.vis.ui.widget.Menu; //导入依赖的package包/类
@Override
public void postInit () {
Gdx.app.postRunnable(() -> {
Menu toolMenus = menuBar.getToolsMenu();
if (toolMenus.getChildren().size == 0) {
toolMenus.add(new VisLabel("No tools available", Color.GRAY)).pad(2, 5, 2, 3);
toolMenus.pack();
}
});
}
示例4: getNewInstanceOfActor
import com.kotcrab.vis.ui.widget.Menu; //导入依赖的package包/类
@Override
protected Actor getNewInstanceOfActor(final LmlActorBuilder builder) {
return new Menu(((TextLmlActorBuilder) builder).getText(), builder.getStyleName());
}
示例5: createMenus
import com.kotcrab.vis.ui.widget.Menu; //导入依赖的package包/类
private void createMenus () {
Menu fileMenu = new Menu("File");
Menu editMenu = new Menu("Edit");
Menu windowMenu = new Menu("Window");
Menu helpMenu = new Menu("Help");
fileMenu.addItem(createTestsMenu());
fileMenu.addItem(new MenuItem("menuitem #1"));
fileMenu.addItem(new MenuItem("menuitem #2").setShortcut("f1"));
fileMenu.addItem(new MenuItem("menuitem #3").setShortcut("f2"));
fileMenu.addItem(new MenuItem("menuitem #4").setShortcut("alt + f4"));
MenuItem subMenuItem = new MenuItem("submenu #1");
subMenuItem.setShortcut("alt + insert");
subMenuItem.setSubMenu(createSubMenu());
fileMenu.addItem(subMenuItem);
MenuItem subMenuItem2 = new MenuItem("submenu #2");
subMenuItem2.setSubMenu(createSubMenu());
fileMenu.addItem(subMenuItem2);
MenuItem subMenuItem3 = new MenuItem("submenu disabled");
subMenuItem3.setDisabled(true);
subMenuItem3.setSubMenu(createSubMenu());
fileMenu.addItem(subMenuItem3);
// ---
editMenu.addItem(new MenuItem("menuitem #5"));
editMenu.addItem(new MenuItem("menuitem #6"));
editMenu.addSeparator();
editMenu.addItem(new MenuItem("menuitem #7"));
editMenu.addItem(new MenuItem("menuitem #8"));
editMenu.addItem(createDoubleNestedMenu());
MenuItem disabledItem = new MenuItem("disabled menuitem");
disabledItem.setDisabled(true);
MenuItem disabledItem2 = new MenuItem("disabled menuitem shortcut").setShortcut("alt + f4");
disabledItem2.setDisabled(true);
editMenu.addItem(disabledItem);
editMenu.addItem(disabledItem2);
windowMenu.addItem(new MenuItem("menuitem #9"));
windowMenu.addItem(new MenuItem("menuitem #10"));
windowMenu.addItem(new MenuItem("menuitem #11"));
windowMenu.addSeparator();
windowMenu.addItem(new MenuItem("menuitem #12"));
helpMenu.addItem(new MenuItem("about", new ChangeListener() {
@Override
public void changed (ChangeEvent event, Actor actor) {
Dialogs.showOKDialog(stage, "about", "visui version: " + VisUI.VERSION);
}
}));
menuBar.addMenu(fileMenu);
menuBar.addMenu(editMenu);
menuBar.addMenu(windowMenu);
menuBar.addMenu(helpMenu);
}