• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ListBox类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中de.lessvoid.nifty.controls.ListBox的典型用法代码示例。如果您正苦于以下问题:Java ListBox类的具体用法?Java ListBox怎么用?Java ListBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ListBox类属于de.lessvoid.nifty.controls包,在下文中一共展示了ListBox类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: selectPlayer

import de.lessvoid.nifty.controls.ListBox; //导入依赖的package包/类
public void selectPlayer() {
    ListBox box = popup.findNiftyControl("player_list", ListBox.class);
    List selection = box.getSelection();

    ReplayPlayerLBModel model = (ReplayPlayerLBModel) selection.get(0);

    final ReplayReader replayReader = Globals.app.getStateManager()
            .getState(ReplayReader.class);
    replayReader.selectPlayer(model.getPlayerId());
    nifty.gotoScreen("default_hud");
    new java.util.Timer().schedule(new java.util.TimerTask() {
        @Override
        public void run() {
            replayReader.setEnabled(true);
            Globals.app.getStateManager().getState(ReplayInputHandler.class)
                    .setEnabled(true);
        }
    }, 500);

}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:21,代码来源:ReplayMenu.java


示例2: onStartScreen

import de.lessvoid.nifty.controls.ListBox; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void onStartScreen() {
	Chars cs = SettingsState.getSingleton().chars;
	ListBox<CharEntry> list = (ListBox<CharEntry>) screen.findNiftyControl("listboxCharacters", ListBox.class);
	if (cs != null) {
		for (Char c : cs.chars) {
			list.addItem(new CharEntry(c));
		}
	}
	
	CharEntry ce = new CharEntry();
	if (cs.maxNumChars > cs.chars.size()) {
		ce.newChar = true;
	}
	list.addItem(ce);
	list.selectItemByIndex(0);
	
	Label accountName = screen.findNiftyControl("labelAccountName", Label.class);
	accountName.setText(cs.account.name);
	accountName.setWidth(null);
	
	serverSelected = (SettingsState.getSingleton().server != null ? true : false);
	
	if (serverSelected) {
		refreshServerLabel();
	} else {
		List<Server> servers = cs.servers;
		showServerPopup(servers);
	}
}
 
开发者ID:AMPBEdu,项目名称:gjOryx,代码行数:32,代码来源:CharsScreen.java


示例3: showServerPopup

import de.lessvoid.nifty.controls.ListBox; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void showServerPopup(List<Server> servers) {
	popupServers = nifty.createPopup("popupServers");
	ListBox<Server> list = popupServers.findNiftyControl("listboxServers", ListBox.class);
	list.addAllItems(servers);
	list.selectItemByIndex(0);
	nifty.showPopup(screen, popupServers.getId(), null);
}
 
开发者ID:AMPBEdu,项目名称:gjOryx,代码行数:9,代码来源:CharsScreen.java


示例4: fillList

import de.lessvoid.nifty.controls.ListBox; //导入依赖的package包/类
protected void fillList(String id, List<String> strings){
    ListBox lb = guiCtrl.getControl(id, ListBox.class);
    List<Integer> selected = lb.getSelectedIndices();
    int index;
    if(!selected.isEmpty())
        index = selected.get(0);
    else
        index = 0;
    lb.clear();
    lb.addAllItems(strings);
    lb.selectItemByIndex(index);
}
 
开发者ID:methusalah,项目名称:OpenRTS,代码行数:13,代码来源:GUIDrawer.java


示例5: listGames

import de.lessvoid.nifty.controls.ListBox; //导入依赖的package包/类
public void listGames(List<Game> games) {
    Element layer = screen.findElementById("layer_games");
    ListBox listbox = layer.findNiftyControl("lb_games", ListBox.class);
    
    listbox.clear();
    listbox.addAllItems(games);
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:8,代码来源:ConnectionMenu.java


示例6: closeGameList

import de.lessvoid.nifty.controls.ListBox; //导入依赖的package包/类
public void closeGameList() {
    Element layer = screen.findElementById("layer_games");
    ListBox listbox = layer.findNiftyControl("lb_games", ListBox.class);
    listbox.clear();
    
    layer.hideWithoutEffect();        
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:8,代码来源:ConnectionMenu.java


示例7: selectGame

import de.lessvoid.nifty.controls.ListBox; //导入依赖的package包/类
public void selectGame() {
    ListBox listbox = screen.findNiftyControl("lb_games", ListBox.class);
    
    if (listbox.getSelection().isEmpty()) {
        return;
    }
    
    Game selection = (Game) listbox.getSelection().get(0);
    screen.findNiftyControl("server_ip", TextField.class)
            .setText(selection.address);
    screen.findNiftyControl("server_port", TextField.class)
            .setText("" + selection.port);
    closeGameList();
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:15,代码来源:ConnectionMenu.java


示例8: selectReplay

import de.lessvoid.nifty.controls.ListBox; //导入依赖的package包/类
public void selectReplay() {
    ListBox replayBox
            = screen.findNiftyControl("replay_list", ListBox.class);
    List selection = replayBox.getSelection();
    if (selection.isEmpty()) {
        return;
    }

    String replay = selection.get(0).toString();

    Path path = Paths.get("replays", replay);
    try {
        ReplayReader replayReader = Globals.app.getStateManager()
                .getState(ReplayReader.class);
        replayReader.loadReplay(path.toString());
        Map<Integer, String> playerMap
                = replayReader.getData().getHeader().getPlayers();

        List<Integer> playersList = new ArrayList<>(playerMap.keySet());

        Collections.sort(playersList);
        ListBox playerBox
                = popup.findNiftyControl("player_list", ListBox.class);
        playerBox.clear();

        for (int playerId : playersList) {
            String playerName = playerMap.get(playerId);
            ReplayPlayerLBModel model
                    = new ReplayPlayerLBModel(playerId, playerName);
            playerBox.addItem(model);
        }

        nifty.showPopup(screen, popup.getId(), null);

    } catch (IOException ex) {
        Logger.getLogger(ReplayMenu.class.getName())
                .log(Level.WARNING, null, ex);
    }
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:40,代码来源:ReplayMenu.java


示例9: onEndScreen

import de.lessvoid.nifty.controls.ListBox; //导入依赖的package包/类
@Override
public void onEndScreen() {
    popup.findNiftyControl("player_list", ListBox.class).clear();
    if (screen.findElementById(popup.getId()) != null) {
        nifty.closePopup(popup.getId());
    }

    ListBox replayBox
            = screen.findNiftyControl("replay_list", ListBox.class);
    replayBox.clear();
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:12,代码来源:ReplayMenu.java


示例10: findReplays

import de.lessvoid.nifty.controls.ListBox; //导入依赖的package包/类
private void findReplays() {
    ListBox box = screen.findNiftyControl("replay_list", ListBox.class);
    box.clear();
    File folder = new File("replays");
    File[] fileList = folder.listFiles(filenameFilter);
    Arrays.sort(fileList, Collections.reverseOrder());
    for (File file : fileList) {
        box.addItem(file.getName());
    }
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:11,代码来源:ReplayMenu.java


示例11: addChatLine

import de.lessvoid.nifty.controls.ListBox; //导入依赖的package包/类
/**Adds a line of text sent by the network to the the player's chat box.
 * Breaks up longer messages into multiple lines to avoid breaching the bounds
 * of the chat box
 *
 * @param name - the name of the player sending the message
 * @param line - the message sent
 */
@SuppressWarnings("unchecked")
public void addChatLine(String name, String line){
	@SuppressWarnings("rawtypes")
	ListBox lb = nifty.getScreen("hud").findNiftyControl("listBoxChat",ListBox.class);
	if (line.length() + name.length() > 55){
		while (line.length() > 35){
			String splitLine = line.substring(0,35);
			lb.addItem("<"+name+">"+": "+splitLine);
			line = line.substring(35);
		}
	}
	lb.addItem("<"+name+">"+": "+line);
	lb.showItem(lb.getItems().get(lb.getItems().size()-1));
}
 
开发者ID:GSam,项目名称:Game-Project,代码行数:22,代码来源:HudScreenController.java


示例12: bind

import de.lessvoid.nifty.controls.ListBox; //导入依赖的package包/类
@Override
public void bind(Nifty nifty, Screen screen) {
    this.nifty = nifty;
    final ScreenController This = this;
    Screen dialog = new ScreenBuilder(SCREEN_ID) {
        {
            controller(This);
            layer(new LayerBuilder("foreground") {
                {
                    childLayoutCenter();

                    control(new ListBoxBuilder("moleculeList") {
                        {
                            childLayoutVertical();
                            set("horizontal", "false");
                            displayItems(10);
                            selectionModeSingle();
                            optionalVerticalScrollbar();
                            optionalHorizontalScrollbar();
                            width("85%");
                            height("85%");
                            x("8%");
                            y("10%");
                        }
                    });

                }
            });
        }
    }.build(nifty);

    //Element e = dialog.findElementByName("foreground");

    /*CreateListBoxControl clistBox = new CreateListBoxControl("listBoxDynamic");
     clistBox.set("horizontal", "false");
     clistBox.setWidth("85%");
     clistBox.setHeight("85%");
     //clistBox.setY("10%");
     //clistBox.setX("8%");
     clistBox.setChildLayout("vertical");
     clistBox.set("displayItems", "10");
     clistBox.set("vertical", "optional");
     clistBox.set("horizontal", "optional");


     listBox = clistBox.create(nifty, dialog, e);

     File dir = Constants.getMoleculeLocation();
     File[] fs = dir.listFiles();
     if (fs == null) {
     fs = new File[0];
     }
     for (File f : fs) {
     String name = FileTools.getFileName(f);
     listBox.addItem(name);
     }*/
    ListBox box = dialog.findNiftyControl("moleculeList", ListBox.class);
    // add items; box.addItem

    File dir = Constants.getMoleculeLocation();
    String[] fs = FileTools.listSubFiles(dir);

    for (String subF : fs) {
        box.addItem(subF);
    }

    nifty.addScreen(SCREEN_ID, dialog);
    nifty.gotoScreen(SCREEN_ID);
}
 
开发者ID:matthewseal,项目名称:MoleculeViewer,代码行数:70,代码来源:MoleculeDialog.java


示例13: bind

import de.lessvoid.nifty.controls.ListBox; //导入依赖的package包/类
@Override
public void bind(Nifty nifty, Screen screen) {
    this.listBox = screen.findNiftyControl("list-servers", ListBox.class);
    this.fillServerList();
}
 
开发者ID:LeNiglo,项目名称:TinyTank,代码行数:6,代码来源:WindowAccount.java


示例14: onEndScreen

import de.lessvoid.nifty.controls.ListBox; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void onEndScreen() {
	ListBox<CharEntry> list = (ListBox<CharEntry>) screen.findNiftyControl("listboxCharacters", ListBox.class);
	list.clear();
}
 
开发者ID:AMPBEdu,项目名称:gjOryx,代码行数:7,代码来源:CharsScreen.java



注:本文中的de.lessvoid.nifty.controls.ListBox类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TileEntitySign类代码示例发布时间:2022-05-22
下一篇:
Java BSFDeclaredBean类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap