当前位置: 首页>>代码示例>>Java>>正文


Java ScreenBuilder类代码示例

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


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

示例1: show

import de.lessvoid.nifty.builder.ScreenBuilder; //导入依赖的package包/类
public void show(Nifty nifty, final String message) {
    this.nifty = nifty;

    ScreenBuilder builder;
    if (Constants.android) {
        builder = createAndroid(message);
    } else {
        builder = createDesktop(message);
    }
    Screen scr = builder.build(nifty);

    textField = scr.findNiftyControl("textField", TextField.class);

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

示例2: show

import de.lessvoid.nifty.builder.ScreenBuilder; //导入依赖的package包/类
public void show(Nifty nifty, String title, String message) {
    ScreenBuilder builder;
    if (Constants.android) {
        builder = createMobile(title, message);
    } else {
        builder = createDesktop(title, message);
    }

    Screen scr = builder.build(nifty);

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

示例3: buildScreenNow

import de.lessvoid.nifty.builder.ScreenBuilder; //导入依赖的package包/类
public void buildScreenNow(String uniqueScreenId) {

        new ScreenBuilder(uniqueScreenId) {
            {
                controller(screenController); // Screen properties

                // <layer>
                layer(new LayerBuilder("Layer_ID") {
                    {
                        childLayoutVertical(); // layer properties, add more...

                        text(new TextBuilder("text") {
                            {
                                text("Screen made " + ++counter + " times from Generator2 with name " + uniqueScreenId);
                                style("nifty-label");
                                alignCenter();
                                valignCenter();
                                height("20%");
                            }
                        });

                        panel(new PanelBuilder("Panel_ID") {
                            {
                                height("20%");
                                childLayoutHorizontal();

                                control(new ButtonBuilder("PreviousButton", "Back") {
                                    {
                                        alignCenter();
                                        valignCenter();
                                        interactOnClick("back()");
                                    }
                                });

                                control(new ButtonBuilder("NextButton", "Next") {
                                    {
                                        alignCenter();
                                        valignCenter();
                                        interactOnClick("next()");
                                    }
                                });



                            }
                        });

                    }
                });
                // </layer>
            }
        }.build(nifty);
    }
 
开发者ID:albertonavarro,项目名称:nifty-flow,代码行数:54,代码来源:Generator2.java

示例4: createNiftyElement

import de.lessvoid.nifty.builder.ScreenBuilder; //导入依赖的package包/类
@Override
public void createNiftyElement(Nifty nifty) {
    Screen screen = new ScreenBuilder(id){{
         
    }}.build(nifty);
    nElement = screen.getRootElement();
     for(String sel : attributes.keySet()){
           nElement.getElementType().getAttributes().set(sel, attributes.get(sel));
     }
    
}
 
开发者ID:relu91,项目名称:niftyeditor,代码行数:12,代码来源:GScreen.java

示例5: generateScreen

import de.lessvoid.nifty.builder.ScreenBuilder; //导入依赖的package包/类
public void generateScreen(){
	
	nifty.addScreen("victory", new ScreenBuilder("victory") {{
		layer(new LayerBuilder("background") {{
			childLayoutCenter();
			image(new ImageBuilder() {{
				width("100%");
				height("100%");
				filename("Interface/victory.jpg");
			}});
		}});

	}}.build(nifty));
}
 
开发者ID:GSam,项目名称:Game-Project,代码行数:15,代码来源:VictoryScreen.java

示例6: generateScreen

import de.lessvoid.nifty.builder.ScreenBuilder; //导入依赖的package包/类
/**Generates the StartScreen and binds elements**/

public void generateScreen(){
	
	nifty.addScreen("start", new ScreenBuilder("start") {{
		controller(screenController);
		layer(new LayerBuilder("background") {{
			childLayoutCenter();
			image(new ImageBuilder() {{
				filename("Interface/outPostStartScreen.png");
			}});

		}});

		//Sets up spacing elements, image, and image button to commence game
		layer(new LayerBuilder("foreground") {{
			childLayoutVertical();
			width("100%");
			height("100%");
			panel(new PanelBuilder(){{
				height("80%");
				alignCenter();
			}});
			image(new ImageBuilder("StartButton"){{
				height("10%");
				width("15%");
				filename("Interface/StartButton.png");
				alignCenter();
				visibleToMouse(true);
				interactOnClick("startGame(loading)");
				onHoverEffect(new HoverEffectBuilder("changeImage"){{
					effectParameter("active", "Interface/StartButtonGlow.png");
					effectParameter("inactive", "Interface/StartButton.png");
				}});
			}});
		}});
	}}.build(nifty));
}
 
开发者ID:GSam,项目名称:Game-Project,代码行数:39,代码来源:StartScreen.java

示例7: createDesktop

import de.lessvoid.nifty.builder.ScreenBuilder; //导入依赖的package包/类
ScreenBuilder createDesktop(final String title, final String message) {
    final ScreenController controller = this;

    return new ScreenBuilder(SCREEN_ID) {
        {
            controller(controller);
            layer(new LayerBuilder("foreground") {
                {
                    childLayoutCenter();
                    panel(new PanelBuilder("panel") {
                        {
                            style("nifty-panel-simple");
                            childLayoutAbsolute();

                            width("400");
                            height("125");

                            control(new LabelBuilder("title", title) {
                                {
                                    x("0");
                                    y("0");
                                    width("400");
                                    height("30");
                                }
                            });

                            control(new TextFieldBuilder("message") {
                                {
                                    x("0");
                                    y("45");

                                    width("100%");
                                    height("30");
                                    text(message);
                                }
                            });
                        }
                    });
                }
            });
        }
    };
}
 
开发者ID:matthewseal,项目名称:MoleculeViewer,代码行数:44,代码来源:TextDialog.java

示例8: createMobile

import de.lessvoid.nifty.builder.ScreenBuilder; //导入依赖的package包/类
ScreenBuilder createMobile(final String title, final String message) {
    final ScreenController controller = this;

    return new ScreenBuilder(SCREEN_ID) {
        {
            controller(controller);
            layer(new LayerBuilder("foreground") {
                {
                    childLayoutCenter();
                    panel(new PanelBuilder("panel") {
                        {
                            style("nifty-panel-simple");
                            childLayoutAbsolute();

                            width("90%");
                            height("300");

                            control(new LabelBuilder("title", title) {
                                {
                                    x("0");
                                    y("0");
                                    width("100%");
                                    height("60");
                                }
                            });

                            control(new TextFieldBuilder("message") {
                                {
                                    x("0");
                                    y("150");

                                    width("100%");
                                    height("60");
                                    text(message);
                                }
                            });
                        }
                    });
                }
            });
        }
    };
}
 
开发者ID:matthewseal,项目名称:MoleculeViewer,代码行数:44,代码来源:TextDialog.java

示例9: createAndroid

import de.lessvoid.nifty.builder.ScreenBuilder; //导入依赖的package包/类
private ScreenBuilder createAndroid(final String message) {
    final ScreenController This = this;

    return new ScreenBuilder(SCREEN_ID) {
        {
            controller(This);
            layer(new LayerBuilder("foreground") {
                {
                    childLayoutCenter();
                    panel(new PanelBuilder("panel") {
                        {
                            style("nifty-panel-simple");
                            childLayoutAbsolute();
                            //x("100px");
                            //y("100px");
                            width("750px");
                            height("175px");

                            control(new LabelBuilder("title", message) {
                                {
                                    x("0");
                                    y("0");
                                    width("600px");
                                    height("60px");
                                }
                            });
                            control(new TextFieldBuilder("textField") {
                                {
                                    maxLength(20);
                                    x("10");
                                    y("75");
                                    width("450px");
                                    height("60px");
                                }
                            });
                            control(new ButtonBuilder("enter", "Enter") {
                                {
                                    x("500");
                                    y("75");
                                    height("60px");
                                    width("200px");
                                    interactOnClick("enter()");
                                }
                            });
                        }
                    });
                }
            });
        }
    };
}
 
开发者ID:matthewseal,项目名称:MoleculeViewer,代码行数:52,代码来源:TextinputDialog.java

示例10: createDesktop

import de.lessvoid.nifty.builder.ScreenBuilder; //导入依赖的package包/类
private ScreenBuilder createDesktop(final String message) {
    final ScreenController This = this;
    return new ScreenBuilder(SCREEN_ID) {
        {
            controller(This);
            layer(new LayerBuilder("foreground") {
                {
                    childLayoutCenter();
                    panel(new PanelBuilder("panel") {
                        {
                            style("nifty-panel-simple");
                            childLayoutAbsolute();
                            //x("100px");
                            // y("100px");
                            width("350px");
                            height("100px");

                            control(new LabelBuilder("title", message) {
                                {
                                    x("0");
                                    y("0");
                                    width("350px");
                                    height("40px");
                                }
                            });
                            control(new TextFieldBuilder("textField") {
                                {
                                    maxLength(20);
                                    x("10");
                                    y("45");
                                    width("200px");
                                    height("25px");
                                }
                            });
                            control(new ButtonBuilder("enter", "Enter") {
                                {
                                    x("225");
                                    y("45");
                                    height("25px");
                                    interactOnClick("enter()");
                                }
                            });
                        }
                    });
                }
            });
        }
    };
}
 
开发者ID:matthewseal,项目名称:MoleculeViewer,代码行数:50,代码来源:TextinputDialog.java

示例11: bind

import de.lessvoid.nifty.builder.ScreenBuilder; //导入依赖的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

示例12: simpleInitApp

import de.lessvoid.nifty.builder.ScreenBuilder; //导入依赖的package包/类
@Override
public void simpleInitApp() {
    NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(
            assetManager, inputManager, audioRenderer, guiViewPort);
    Nifty nifty = niftyDisplay.getNifty();
    guiViewPort.addProcessor(niftyDisplay);
    flyCam.setDragToRotate(true);

    nifty.loadStyleFile("nifty-default-styles.xml");
    nifty.loadControlFile("nifty-default-controls.xml");

    /* ------------------ NEW CODE ----------------- */
    DefaultInstanceResolutor defaultInstanceResolutor = new DefaultInstanceResolutor();
    ScreenFlowManager screenFlowManager = new ScreenFlowManagerImpl(nifty, defaultInstanceResolutor);

    //Main structures, made up resolutors depending on what you prefer to use
    LiveInstanceResolutor liveInstanceResolutor = new LiveInstanceResolutor();
    defaultInstanceResolutor.addResolutor("static", new StaticScreenGeneratorResolutor(nifty));
    defaultInstanceResolutor.addResolutor("live", liveInstanceResolutor);

    //Some examples of live instances, in case you prefer them
    RootScreenController screenController = new RootScreenController().setScreenFlowManager(screenFlowManager).setApplication(this);
    ScreenController screenController2 = new Controller2(screenFlowManager);
    ScreenController screenController4 = new Controller4(screenFlowManager);
    liveInstanceResolutor.addController("root", screenController);
    liveInstanceResolutor.addGenerator("root", new RootScreenGenerator(nifty, screenController, screenFlowManager));
    liveInstanceResolutor.addController("controller1", new Controller1(screenFlowManager));
    liveInstanceResolutor.addController("controller2", screenController2);
    liveInstanceResolutor.addController("controller3", new Controller3(screenFlowManager));
    liveInstanceResolutor.addController("controller4", new Controller4(screenFlowManager));

    liveInstanceResolutor.addGenerator("generator2", new Generator2(nifty, screenController2));
    liveInstanceResolutor.addGenerator("generator4", new Generator4(nifty, screenController4));

    try {
        //My first flow definition
        screenFlowManager.addScreenDefinition(new ScreenDefinition("root", "live:root", "live:root"));
        screenFlowManager.addScreenDefinition(new ScreenDefinition("screen1", "live:controller1", "static:/screen.xml"));
        screenFlowManager.addScreenDefinition(new ScreenDefinition("screen2", "live:controller2", "live:generator2"));
        screenFlowManager.addScreenDefinition(new ScreenDefinition("screen3", "live:controller1", "static:/screen.xml"));
        screenFlowManager.addScreenDefinition(new ScreenDefinition("screen4", "live:controller4", "live:generator4"));

        screenFlowManager.addFlowDefinition("root", Optional.<String>absent(), newArrayList("root")); //parent is absent, this is root.
        screenFlowManager.addFlowDefinition("screenFlow1", of("root:root"), newArrayList("screen1", "screen2", "screen3", "screen4"));
        screenFlowManager.addFlowDefinition("screenFlow2", of("root:root"), newArrayList("screen1", "screen4"));

        //Once I finished to load flows, I'm ready to start, mandatory name, mandatory implementation
        nifty.addScreen("redirector", new ScreenBuilder("start", new RedirectorScreenController().setScreenFlowManager(screenFlowManager)).build(nifty));
        nifty.gotoScreen("redirector");

    } catch (InstanceResolutionException e) {
        e.printStackTrace();
    }


}
 
开发者ID:albertonavarro,项目名称:nifty-flow,代码行数:57,代码来源:Main.java

示例13: buildScreenNow

import de.lessvoid.nifty.builder.ScreenBuilder; //导入依赖的package包/类
public void buildScreenNow(String uniqueScreenId) {

        new ScreenBuilder(uniqueScreenId) {
            {
                controller(screenController); // Screen properties

                // <layer>
                layer(new LayerBuilder("Layer_ID") {
                    {
                        childLayoutVertical(); // layer properties, add more...

                        panel(new PanelBuilder("Panel_ID") {
                            {
                                height("20%");
                                childLayoutHorizontal();

                                text(new TextBuilder("text") {
                                    {
                                        text("Screen made one time only from Generator4 with name " + uniqueScreenId);
                                        style("nifty-label");
                                        alignCenter();
                                        valignCenter();
                                        height("20%");
                                    }});

                                control(new ButtonBuilder("PreviousButton", "Back") {
                                    {
                                        alignCenter();
                                        valignCenter();
                                        interactOnClick("back()");
                                    }
                                });



                            }
                        });

                    }
                });
                // </layer>
            }
        }.build(nifty);
    }
 
开发者ID:albertonavarro,项目名称:nifty-flow,代码行数:45,代码来源:Generator4.java

示例14: buildScreen

import de.lessvoid.nifty.builder.ScreenBuilder; //导入依赖的package包/类
@Override
public void buildScreen(String uniqueScreenId, String controllerClassName) {

    final PanelBuilder panelModules = new PanelBuilder("Panel_Modules") {
        {
            childLayoutVertical();
            alignCenter();
            height("80%");
        }
    };

    for (final String moduleName : screenFlowManager.getChildren()) {
        panelModules.control(new ButtonBuilder(moduleName + "ButtonLabel", moduleName) {
            {
                alignCenter();
                valignCenter();
                height("11%");
                width("20%");
                interactOnClick("executeModule(" + moduleName + ")");
            }
        });
    }

    final PanelBuilder panelMessage = new PanelBuilder("Panel_Message") {
        {
            childLayoutVertical();
            alignCenter();
            height("10%");
        }
    };

    final PanelBuilder panelQuit = new PanelBuilder("Panel_Quit") {
        {
            childLayoutVertical();
            height("10%");
        }
    };

    panelQuit.control(new ButtonBuilder("QuitButton", "Quit") {
        {
            alignRight();
            valignCenter();
            height("100%");
            width("20%");
            interactOnClick("quit()");
        }
    });

    new ScreenBuilder(uniqueScreenId) {
        {
            controller(startScreenController);
            layer(new LayerBuilder("Layer_Main") {
                {
                    backgroundColor(Color.BLACK);
                    childLayoutVertical();
                    panel(panelModules);
                    panel(panelMessage);
                    panel(panelQuit);
                }
            });
        }
    }.build(nifty);

}
 
开发者ID:albertonavarro,项目名称:nifty-flow,代码行数:65,代码来源:RootScreenGenerator.java

示例15: generateScreen

import de.lessvoid.nifty.builder.ScreenBuilder; //导入依赖的package包/类
public void generateScreen(){
	
	nifty.addScreen("loading", new ScreenBuilder("loading") {{
		controller(screenController);
		layer(new LayerBuilder("background") {{
			childLayoutCenter();
			image(new ImageBuilder() {{
				filename("Interface/LoadingScreen.png");
			}});
		}});
		layer(new LayerBuilder("foreground") {{
			childLayoutVertical();
			panel(new PanelBuilder("hintTextPadding"){{
				height("65%");
				alignCenter();
			}});
			
			//displays hints on the loading screen
			text(new TextBuilder("hintText"){{
				alignCenter();
				height("10%");
				width("10%");
				text("");
				font("Interface/Fonts/ItemText.fnt");
				onShowEffect(new EffectBuilder("fade"){{
					length(2000);
					startDelay(2000);
					onEndEffectCallback("loadWorld()");
				}});
			}});

			//fade with callback to help buffer loading
			image(new ImageBuilder("loadImage2") {{
				visible(false);
				onShowEffect(new EffectBuilder("fade"){{
					length(2000);
					startDelay(2000);
					onEndEffectCallback("startHud()");
				}});
			}});
			
		}});

	}}.build(nifty));
}
 
开发者ID:GSam,项目名称:Game-Project,代码行数:46,代码来源:LoadingScreen.java


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