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


Java Component.setSize方法代码示例

本文整理汇总了Java中com.watabou.noosa.ui.Component.setSize方法的典型用法代码示例。如果您正苦于以下问题:Java Component.setSize方法的具体用法?Java Component.setSize怎么用?Java Component.setSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.watabou.noosa.ui.Component的用法示例。


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

示例1: WndJournal

import com.watabou.noosa.ui.Component; //导入方法依赖的package包/类
public WndJournal() {

		super();
		resize(WIDTH, ShatteredPixelDungeon.landscape() ? HEIGHT_L : HEIGHT_P);

		txtTitle = PixelScene.renderText(TXT_TITLE, 9);
		txtTitle.hardlight(Window.TITLE_COLOR);
		txtTitle.x = PixelScene.align(PixelScene.uiCamera,
				(WIDTH - txtTitle.width()) / 2);
		add(txtTitle);

		Component content = new Component();

		Collections.sort(Journal.records);

		float pos = 0;
		for (Journal.Record rec : Journal.records) {
			ListItem item = new ListItem(rec.feature, rec.depth);
			item.setRect(0, pos, WIDTH, ITEM_HEIGHT);
			content.add(item);

			pos += item.height();
		}

		content.setSize(WIDTH, pos);

		list = new ScrollPane(content);
		add(list);

		list.setRect(0, txtTitle.height(), WIDTH, height - txtTitle.height());
	}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:32,代码来源:WndJournal.java

示例2: WndJournal

import com.watabou.noosa.ui.Component; //导入方法依赖的package包/类
public WndJournal() {
	
	super();
	resize( WIDTH, PixelDungeon.landscape() ? HEIGHT_L : HEIGHT_P );
	
	txtTitle = PixelScene.createText( TXT_TITLE, 9 );
	txtTitle.hardlight( Window.TITLE_COLOR );
	txtTitle.measure();
	txtTitle.x = PixelScene.align( PixelScene.uiCamera, (WIDTH - txtTitle.width()) / 2 );
	add( txtTitle );
	
	Component content = new Component();
	
	Collections.sort( Journal.records );
	
	float pos = 0;
	for (Journal.Record rec : Journal.records) {
		ListItem item = new ListItem( rec.feature, rec.depth );
		item.setRect( 0, pos, WIDTH, ITEM_HEIGHT );
		content.add( item );
		
		pos += item.height();
	}
	
	content.setSize( WIDTH, pos );
	
	list = new ScrollPane( content );
	add( list );
	
	list.setRect( 0, txtTitle.height(), WIDTH, height - txtTitle.height() );
}
 
开发者ID:kurtyu,项目名称:PixelDungeonTC,代码行数:32,代码来源:WndJournal.java

示例3: WndJournal

import com.watabou.noosa.ui.Component; //导入方法依赖的package包/类
public WndJournal() {
	
	super();
	resize( WIDTH, ShatteredPixelDungeon.landscape() ? HEIGHT_L : HEIGHT_P );

	txtTitle = PixelScene.createText( TXT_TITLE, 9 );
	txtTitle.hardlight( Window.TITLE_COLOR );
	txtTitle.measure();
	txtTitle.x = PixelScene.align( PixelScene.uiCamera, (WIDTH - txtTitle.width()) / 2 );
	add( txtTitle );
	
	Component content = new Component();
	
	Collections.sort( Journal.records );
	
	float pos = 0;
	for (Journal.Record rec : Journal.records) {
		ListItem item = new ListItem( rec.feature, rec.depth );
		item.setRect( 0, pos, WIDTH, ITEM_HEIGHT );
		content.add( item );
		
		pos += item.height();
	}
	
	content.setSize( WIDTH, pos );
	
	list = new ScrollPane( content );
	add( list );

	list.setRect( 0, txtTitle.height(), WIDTH, height - txtTitle.height() );
}
 
开发者ID:FthrNature,项目名称:unleashed-pixel-dungeon,代码行数:32,代码来源:WndJournal.java

示例4: WndJournal

import com.watabou.noosa.ui.Component; //导入方法依赖的package包/类
public WndJournal() {
	
	super();
	resize( WIDTH, HEIGHT );
	
	txtTitle = PixelScene.createText( TXT_TITLE, 9 );
	txtTitle.hardlight( Window.TITLE_COLOR );
	txtTitle.measure();
	txtTitle.x = PixelScene.align( PixelScene.uiCamera, (WIDTH - txtTitle.width()) / 2 );
	add( txtTitle );
	
	Component content = new Component();
	
	Collections.sort( Journal.records );
	
	float pos = 0;
	for (Journal.Record rec : Journal.records) {
		ListItem item = new ListItem( rec.feature, rec.depth );
		item.setRect( 0, pos, WIDTH, ITEM_HEIGHT );
		content.add( item );
		
		pos += item.height();
	}
	
	content.setSize( WIDTH, pos );
	
	list = new ScrollPane( content );
	add( list );
	
	list.setRect( 0, txtTitle.height(), WIDTH, HEIGHT - txtTitle.height() );
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:32,代码来源:WndJournal.java

示例5: setupList

import com.watabou.noosa.ui.Component; //导入方法依赖的package包/类
private void setupList() {
	Component content = buffList.content();
	for (Buff buff : Dungeon.hero.buffs()) {
		if (buff.icon() != BuffIndicator.NONE) {
			BuffSlot slot = new BuffSlot(buff);
			slot.setRect(0, pos, WIDTH, slot.icon.height());
			content.add(slot);
			slots.add(slot);
			pos += GAP + slot.height();
		}
	}
	content.setSize(buffList.width(), pos);
	buffList.setSize(buffList.width(), buffList.height());
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:15,代码来源:WndHero.java

示例6: updateList

import com.watabou.noosa.ui.Component; //导入方法依赖的package包/类
private void updateList(){
	Component content = list.content();
	
	float pos = 0;
	
	ColorBlock line = new ColorBlock( width(), 1, 0xFF222222);
	line.y = pos;
	content.add(line);
	
	RenderedTextMultiline title = PixelScene.renderMultiline(Document.ADVENTURERS_GUIDE.title(), 9);
	title.hardlight(TITLE_COLOR);
	title.maxWidth( (int)width() - 2 );
	title.setPos( (width() - title.width())/2f, pos + 1 + ((ITEM_HEIGHT) - title.height())/2f);
	PixelScene.align(title);
	content.add(title);
	
	pos += Math.max(ITEM_HEIGHT, title.height());
	
	for (String page : Document.ADVENTURERS_GUIDE.pages()){
		GuideItem item = new GuideItem( page );
		
		item.setRect( 0, pos, width(), ITEM_HEIGHT );
		content.add( item );
		
		pos += item.height();
		pages.add(item);
	}
	
	content.setSize( width(), pos );
	list.setSize( list.width(), list.height() );
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:32,代码来源:WndJournal.java

示例7: 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());
}
 
开发者ID:NYRDS,项目名称:pixel-dungeon-remix,代码行数:30,代码来源:GenericInfo.java

示例8: WndStory

import com.watabou.noosa.ui.Component; //导入方法依赖的package包/类
public WndStory( String text ) {
	super( 0, 0, Chrome.get( Chrome.Type.SCROLL ) );

	Text tf = PixelScene.createMultiline(text, GuiProperties.regularFontSize());
	tf.maxWidth(WIDTH - MARGIN * 2);
	tf.measure();
	tf.ra = bgR;
	tf.ga = bgG;
	tf.ba = bgB;
	tf.rm = -bgR;
	tf.gm = -bgG;
	tf.bm = -bgB;
	tf.x = MARGIN;
	
	int h = (int) Math.min(HEIGHT - MARGIN, tf.height());
	int w = (int)(tf.width() + MARGIN * 2);
	
	resize( w, h );
	
	Component content = new Component();
	
	content.add(tf);
	
	content.setSize(tf.width(), tf.height());
	
	ScrollPane list = new ScrollPane(content);
	add(list);

	list.setRect(0, 0, w, h);
}
 
开发者ID:NYRDS,项目名称:pixel-dungeon-remix,代码行数:31,代码来源:WndStory.java

示例9: 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();
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:57,代码来源:ChangesScene.java

示例10: 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();
}
 
开发者ID:mango-tree,项目名称:UNIST-pixel-dungeon,代码行数:57,代码来源:ChangesScene.java

示例11: WndLibraryCatalogue

import com.watabou.noosa.ui.Component; //导入方法依赖的package包/类
public WndLibraryCatalogue(String category, String catalogueName) {
	super();

	int yPos = 0;

	//Title
	Text listTitle = PixelScene.createMultiline(catalogueName, GuiProperties.mediumTitleFontSize());
	listTitle.hardlight(TITLE_COLOR);
	listTitle.maxWidth(WIDTH - GAP * 2);
	listTitle.measure();
	listTitle.x = (WIDTH - listTitle.width()) / 2;
	listTitle.y = 0;

	add(listTitle);

	Component content = new Component();

	Map<String, Integer> knownMap = Library.getKnowledgeMap(category);

	//List
	for (final String entry : knownMap.keySet()) {

		//Button
		Library.EntryHeader entryHeader = Library.infoHeader(category, entry);

		LibraryListItem rb = new LibraryListItem(category, entry, entryHeader);

		rb.setRect(0, yPos, WIDTH, BTN_HEIGHT);
		content.add(rb);

		yPos = (int) rb.bottom() + 1;
	}

	int HEIGHT = WndHelper.getFullscreenHeight() - BTN_HEIGHT * 2;
	int h = Math.min(HEIGHT - GAP, yPos);

	resize(WIDTH, h + BTN_WIDTH);

	content.setSize(WIDTH, yPos);

	ScrollPane list = new ScrollableList(content);

	add(list);

	float topGap = listTitle.height() + GAP;
	float BottomGap = listTitle.bottom() - BTN_HEIGHT / 2;

	list.setRect(0, topGap, WIDTH, HEIGHT - BottomGap);

	//Back Button
	TextButton back = new RedButton(Game.getVar(R.string.Wnd_Button_Back)) {
		@Override
		protected void onClick() {
			super.onClick();
			hide();
			GameScene.show(new WndLibrary());
		}
	};

	back.setRect((WIDTH / 2) - (BTN_WIDTH / 2), (int) list.bottom() + GAP, BTN_WIDTH + GAP, BTN_HEIGHT);

	add(back);
}
 
开发者ID:NYRDS,项目名称:pixel-dungeon-remix,代码行数:64,代码来源:WndLibraryCatalogue.java

示例12: 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();
}
 
开发者ID:NYRDS,项目名称:pixel-dungeon-remix,代码行数:77,代码来源:AllowStatisticsCollectionScene.java


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