本文整理汇总了Java中com.kotcrab.vis.ui.widget.MenuItem类的典型用法代码示例。如果您正苦于以下问题:Java MenuItem类的具体用法?Java MenuItem怎么用?Java MenuItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MenuItem类属于com.kotcrab.vis.ui.widget包,在下文中一共展示了MenuItem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: build
import com.kotcrab.vis.ui.widget.MenuItem; //导入依赖的package包/类
public void build(FileItem fileItem) {
clearChildren();
if (fileItem == null) {
addItem(new MenuItem("New Scene", new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
}
}));
}
}
开发者ID:whitecostume,项目名称:libgdx_ui_editor,代码行数:12,代码来源:AssetWindow.java
示例2: initMenuBar
import com.kotcrab.vis.ui.widget.MenuItem; //导入依赖的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());
}
开发者ID:ncguy2,项目名称:Argent,代码行数:17,代码来源:VisualEditorRoot.java
示例3: createRecentDirSuggestions
import com.kotcrab.vis.ui.widget.MenuItem; //导入依赖的package包/类
private int createRecentDirSuggestions (Array<FileHandle> files, float width) {
clearChildren();
int suggestions = 0;
for (final FileHandle file : files) {
if (file.exists() == false) continue;
MenuItem item = createMenuItem(file.path());
item.getLabel().setEllipsis(true);
item.getLabelCell().width(width - 20);
addItem(item);
item.addListener(new ChangeListener() {
@Override
public void changed (ChangeEvent event, Actor actor) {
chooser.setDirectory(file, FileChooser.HistoryPolicy.ADD);
}
});
suggestions++;
if (suggestions == MAX_SUGGESTIONS) {
break;
}
}
return suggestions;
}
开发者ID:kotcrab,项目名称:vis-editor,代码行数:27,代码来源:DirsSuggestionPopup.java
示例4: assignShortcut
import com.kotcrab.vis.ui.widget.MenuItem; //导入依赖的package包/类
private void assignShortcut(Actor actor, String rawAttributeData) {
if (actor instanceof MenuItem) {
MenuItem menuItem = (MenuItem) actor;
String shortcut = App.inst().getShortcuts().resolveShortcutString(rawAttributeData);
menuItem.setShortcut(shortcut);
}
}
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:9,代码来源:ShortcutOnChangeLmlAttribute.java
示例5: process
import com.kotcrab.vis.ui.widget.MenuItem; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final MenuItem actor, final String rawAttributeData) {
Image image = new Image(parser.getData().getDefaultSkin().getDrawable(rawAttributeData));
Container<Image> imageContainer = new Container<>(image);
imageContainer.setFillParent(true);
imageContainer.align(Align.left);
imageContainer.padLeft(25f);
actor.addActor(imageContainer);
}
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:10,代码来源:MenuItemFillImageLmlAttribute.java
示例6: handleValidChild
import com.kotcrab.vis.ui.widget.MenuItem; //导入依赖的package包/类
@Override
protected void handleValidChild(final LmlTag childTag) {
if (childTag.getActor() instanceof MenuItem) {
addMenuItem((MenuItem) childTag.getActor());
} else if (childTag.getActor() instanceof Separator) {
addSeparator((Separator) childTag.getActor());
} else {
getParser().throwErrorIfStrict("Menus can handle only menu item and separator children. Found child tag: "
+ childTag.getTagName() + " with actor: " + childTag.getActor());
}
}
开发者ID:czyzby,项目名称:gdx-lml,代码行数:12,代码来源:MenuPopupLmlTag.java
示例7: attachTo
import com.kotcrab.vis.ui.widget.MenuItem; //导入依赖的package包/类
@Override
public void attachTo(final LmlTag tag) {
if (tag.getActor() instanceof MenuItem) {
((MenuItem) tag.getActor()).setSubMenu(getPopupMenu());
} else {
// Technically, these menus could be attached to any widget with on-click listener, but let's leave that for
// now - this would require a custom listener + possibly a way to modify it.
getParser().throwError(
"Popup menus can currently be attached only to MenuItems as sub-menus. Popup menu was a child of: "
+ tag.getTagName());
}
}
开发者ID:czyzby,项目名称:gdx-lml,代码行数:13,代码来源:MenuPopupLmlTag.java
示例8: getNewInstanceOfActor
import com.kotcrab.vis.ui.widget.MenuItem; //导入依赖的package包/类
@Override
protected final Actor getNewInstanceOfActor(final LmlActorBuilder builder) {
final MenuItemLmlActorBuilder menuItemBuilder = (MenuItemLmlActorBuilder) builder;
final Skin skin = getSkin(builder);
final MenuItemStyle style = skin.get(builder.getStyleName(), MenuItemStyle.class);
if (menuItemBuilder.getImage() == null) {
// No icon specified: passing null image:
return new MenuItem(menuItemBuilder.getText(), (Image) null, style);
}
// Icon specified: passing chosen drawable:
return new MenuItem(menuItemBuilder.getText(), skin.getDrawable(menuItemBuilder.getImage()), style);
}
开发者ID:czyzby,项目名称:gdx-lml,代码行数:13,代码来源:MenuItemLmlTag.java
示例9: handlePlainTextLine
import com.kotcrab.vis.ui.widget.MenuItem; //导入依赖的package包/类
@Override
protected void handlePlainTextLine(final String plainTextLine) {
final MenuItem item = getMenuItem();
final String textToAppend = getParser().parseString(plainTextLine, getActor());
if (Strings.isEmpty(item.getText())) {
item.setText(textToAppend);
} else {
item.setText(item.getText().toString() + textToAppend);
}
}
开发者ID:czyzby,项目名称:gdx-lml,代码行数:11,代码来源:MenuItemLmlTag.java
示例10: getComponentActors
import com.kotcrab.vis.ui.widget.MenuItem; //导入依赖的package包/类
@Override
protected Actor[] getComponentActors(final Actor actor) {
final MenuItem item = (MenuItem) actor;
if (item.getImage() != null) {
return new Actor[] { item.getLabel(), item.getImage() };
}
// Label is never null:
return new Actor[] { item.getLabel() };
}
开发者ID:czyzby,项目名称:gdx-lml,代码行数:10,代码来源:MenuItemLmlTag.java
示例11: createMenuItem
import com.kotcrab.vis.ui.widget.MenuItem; //导入依赖的package包/类
protected MenuItem createMenuItem (String name) {
MenuItem item = new MenuItem(name);
item.getImageCell().size(0);
item.getShortcutCell().space(0).pad(0);
item.getSubMenuIconCell().size(0).space(0).pad(0);
return item;
}
开发者ID:kotcrab,项目名称:vis-editor,代码行数:8,代码来源:AbstractSuggestionPopup.java
示例12: createDoubleNestedMenu
import com.kotcrab.vis.ui.widget.MenuItem; //导入依赖的package包/类
private MenuItem createDoubleNestedMenu () {
MenuItem doubleNestedMenuItem = new MenuItem("submenu nested x2");
doubleNestedMenuItem.setSubMenu(createSubMenu());
PopupMenu nestedMenu = new PopupMenu();
nestedMenu.addItem(doubleNestedMenuItem);
nestedMenu.addItem(new MenuItem("single nested"));
MenuItem menuItem = new MenuItem("submenu nested");
menuItem.setSubMenu(nestedMenu);
return menuItem;
}
开发者ID:kotcrab,项目名称:vis-editor,代码行数:13,代码来源:TestLauncher.java
示例13: createSubMenu
import com.kotcrab.vis.ui.widget.MenuItem; //导入依赖的package包/类
private PopupMenu createSubMenu () {
PopupMenu menu = new PopupMenu();
menu.addItem(new MenuItem("submenuitem #1"));
menu.addItem(new MenuItem("submenuitem #2"));
menu.addSeparator();
menu.addItem(new MenuItem("submenuitem #3"));
menu.addItem(new MenuItem("submenuitem #4"));
return menu;
}
开发者ID:kotcrab,项目名称:vis-editor,代码行数:10,代码来源:TestLauncher.java
示例14: createMenuItem
import com.kotcrab.vis.ui.widget.MenuItem; //导入依赖的package包/类
public static MenuItem createMenuItem (String text, Drawable icon, ButtonListener listener) {
if (listener == null) {
return new MenuItem(text, icon);
} else {
return new MenuItem(text, icon, new ChangeListener() {
@Override
public void changed (ChangeEvent event, Actor actor) {
listener.clicked();
}
});
}
}
开发者ID:kotcrab,项目名称:vis-editor,代码行数:13,代码来源:MenuUtils.java
示例15: getHandledType
import com.kotcrab.vis.ui.widget.MenuItem; //导入依赖的package包/类
@Override
public Class<MenuItem> getHandledType() {
return MenuItem.class;
}
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:5,代码来源:MenuItemFillImageLmlAttribute.java
示例16: process
import com.kotcrab.vis.ui.widget.MenuItem; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final MenuItem actor, final String rawAttributeData) {
actor.setShortcut(parser.parseString(rawAttributeData, actor));
}
开发者ID:czyzby,项目名称:gdx-lml,代码行数:5,代码来源:MenuItemShortcutLmlAttribute.java
示例17: process
import com.kotcrab.vis.ui.widget.MenuItem; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final MenuItem actor, final String rawAttributeData) {
actor.setGenerateDisabledImage(parser.parseBoolean(rawAttributeData, actor));
}
开发者ID:czyzby,项目名称:gdx-lml,代码行数:5,代码来源:MenuItemGenerateDisabledImageLmlAttribute.java
示例18: handlePlainTextLine
import com.kotcrab.vis.ui.widget.MenuItem; //导入依赖的package包/类
@Override
protected void handlePlainTextLine(final String plainTextLine) {
addMenuItem(new MenuItem(getParser().parseString(plainTextLine, getActor())));
}
开发者ID:czyzby,项目名称:gdx-lml,代码行数:5,代码来源:MenuPopupLmlTag.java
示例19: addMenuItem
import com.kotcrab.vis.ui.widget.MenuItem; //导入依赖的package包/类
/** @param menuItem will be added to the menu. Cannot be null. */
protected void addMenuItem(final MenuItem menuItem) {
getPopupMenu().addItem(menuItem);
}
开发者ID:czyzby,项目名称:gdx-lml,代码行数:5,代码来源:MenuPopupLmlTag.java
示例20: getMenuItem
import com.kotcrab.vis.ui.widget.MenuItem; //导入依赖的package包/类
/** @return casted actor. */
protected MenuItem getMenuItem() {
return (MenuItem) getActor();
}
开发者ID:czyzby,项目名称:gdx-lml,代码行数:5,代码来源:MenuItemLmlTag.java
注:本文中的com.kotcrab.vis.ui.widget.MenuItem类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论