本文整理汇总了Java中com.watabou.noosa.ui.Component.clear方法的典型用法代码示例。如果您正苦于以下问题:Java Component.clear方法的具体用法?Java Component.clear怎么用?Java Component.clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.watabou.noosa.ui.Component
的用法示例。
在下文中一共展示了Component.clear方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeInfo
import com.watabou.noosa.ui.Component; //导入方法依赖的package包/类
static public void makeInfo(Window parent, Image icon, String title, int titleColor, String desc){
IconTitle titlebar = new IconTitle();
titlebar.icon( icon );
titlebar.label( Utils.capitalize( title ), titleColor );
titlebar.setRect( 0, 0, WIDTH, 0 );
parent.add( titlebar );
Text txtInfo = PixelScene.createMultiline( desc, GuiProperties.regularFontSize() );
txtInfo.maxWidth(WIDTH);
txtInfo.measure();
txtInfo.setPos(0, 0);
int wndHeight = (int) Math.min((titlebar.bottom() + txtInfo.height() + 3 * GAP),MAX_HEIGHT);
parent.resize( WIDTH, wndHeight);
int scroolZoneHeight = (int) (wndHeight - titlebar.bottom() - GAP * 2);
ScrollPane list = new ScrollPane(new Component());
parent.add(list);
list.setRect(0, titlebar.height() + GAP, WIDTH, scroolZoneHeight);
Component content = list.content();
content.clear();
content.add(txtInfo);
content.setSize(txtInfo.width(), txtInfo.height());
}
示例2: create
import com.watabou.noosa.ui.Component; //导入方法依赖的package包/类
@Override
public void create() {
super.create();
int w = Camera.main.width;
int h = Camera.main.height;
RenderedText title = PixelScene.renderText(Messages.get(this, "title"), 9);
title.hardlight(Window.TITLE_COLOR);
title.x = (w - title.width()) / 2;
title.y = 4;
align(title);
add(title);
ExitButton btnExit = new ExitButton();
btnExit.setPos(Camera.main.width - btnExit.width(), 0);
add(btnExit);
RenderedTextMultiline text = renderMultiline(TXT_Update, 6);
NinePatch panel = Chrome.get(Chrome.Type.TOAST);
int pw = 135 + panel.marginLeft() + panel.marginRight() - 2;
int ph = h - 16;
panel.size(pw, ph);
panel.x = (w - pw) / 2f;
panel.y = title.y + title.height();
align(panel);
add(panel);
ScrollPane list = new ScrollPane(new Component());
add(list);
Component content = list.content();
content.clear();
text.maxWidth((int) panel.innerWidth());
content.add(text);
content.setSize(panel.innerWidth(), (int) Math.ceil(text.height()));
list.setRect(
panel.x + panel.marginLeft(),
panel.y + panel.marginTop() - 1,
panel.innerWidth(),
panel.innerHeight() + 2);
list.scrollTo(0, 0);
Archs archs = new Archs();
archs.setSize(Camera.main.width, Camera.main.height);
addToBack(archs);
fadeIn();
}
示例3: create
import com.watabou.noosa.ui.Component; //导入方法依赖的package包/类
@Override
public void create() {
super.create();
int w = Camera.main.width;
int h = Camera.main.height;
RenderedText title = PixelScene.renderText( Messages.get(this, "title"), 9 );
title.hardlight(Window.TITLE_COLOR);
title.x = (w - title.width()) / 2 ;
title.y = 4;
align(title);
add(title);
ExitButton btnExit = new ExitButton();
btnExit.setPos( Camera.main.width - btnExit.width(), 0 );
add( btnExit );
RenderedTextMultiline text = renderMultiline(TXT_Update, 6 );
NinePatch panel = Chrome.get(Chrome.Type.TOAST);
int pw = 135 + panel.marginLeft() + panel.marginRight() - 2;
int ph = h - 16;
panel.size( pw, ph );
panel.x = (w - pw) / 2f;
panel.y = title.y + title.height();
align( panel );
add( panel );
ScrollPane list = new ScrollPane( new Component() );
add( list );
Component content = list.content();
content.clear();
text.maxWidth((int) panel.innerWidth());
content.add(text);
content.setSize( panel.innerWidth(), (int)Math.ceil(text.height()) );
list.setRect(
panel.x + panel.marginLeft(),
panel.y + panel.marginTop() - 1,
panel.innerWidth(),
panel.innerHeight() + 2);
list.scrollTo(0, 0);
Archs archs = new Archs();
archs.setSize( Camera.main.width, Camera.main.height );
addToBack( archs );
fadeIn();
}
示例4: create
import com.watabou.noosa.ui.Component; //导入方法依赖的package包/类
@Override
public void create() {
super.create();
Text title = createMultiline(TTL_Welcome, GuiProperties.bigTitleFontSize());
int w = Camera.main.width;
int h = Camera.main.height;
int pw = w - 10;
title.maxWidth(pw);
title.measure();
title.x = align((w - title.width()) / 2);
title.y = align(8);
add(title);
NinePatch panel = Chrome.get(Chrome.Type.WINDOW);
panel.x = (w - pw) / 2;
panel.y = title.y + title.height() + GAP * 2;
int ph = (int) (h - panel.y - 22);
panel.size(pw, ph);
add(panel);
ScrollPane list = new ScrollPane(new Component());
add(list);
list.setRect(panel.x + panel.marginLeft(), panel.y + panel.marginTop(), panel.innerWidth(),
panel.innerHeight());
list.scrollTo(0, 0);
Component content = list.content();
content.clear();
float yPos = 0;
Text text = createMultiline(Game.getVar(R.string.AllowStatisticsCollectionScene_Request), GuiProperties.regularFontSize());
text.maxWidth((int) panel.innerWidth());
text.measure();
content.add(text);
yPos += text.height() + GAP;
content.setSize(panel.innerWidth(), yPos);
RedButton allow = new RedButton(Game.getVar(R.string.AllowStatisticsCollectionScene_Allow)) {
@Override
protected void onClick() {
Preferences.INSTANCE.put(Preferences.KEY_COLLECT_STATS, 100);
Game.instance().initEventCollector();
Game.switchScene(TitleScene.class);
}
};
RedButton deny = new RedButton(Game.getVar(R.string.AllowStatisticsCollectionScene_Deny)) {
@Override
protected void onClick() {
Preferences.INSTANCE.put(Preferences.KEY_COLLECT_STATS, -100);
Game.instance().initEventCollector();
Game.switchScene(TitleScene.class);
}
};
allow.setRect((w - pw) / 2, h - 22, pw/2 - GAP, 18);
deny.setRect((w - pw) / 2 + pw/2 , h - 22, pw/2-GAP, 18);
add(allow);
add(deny);
Archs archs = new Archs();
archs.setSize(Camera.main.width, Camera.main.height);
addToBack(archs);
fadeIn();
}