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


Java GuiComponentLabel类代码示例

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


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

示例1: GuiExample

import openmods.gui.component.GuiComponentLabel; //导入依赖的package包/类
public GuiExample(ContainerExample container) {
	super(container, 176, 175, "examplemod.gui.example");
	TileEntityWithGui tile = container.getOwner();

	tabOne = new GuiComponentTab(0xFF0000, new ItemStack(Block.anvil), 100, 100);
	tabTwo = new GuiComponentTab(0x00FF00, new ItemStack(Block.anvil), 100, 100);

	tabs = new GuiComponentTabs(xSize - 3, 4);

	slider = new GuiComponentSlider(40, 55, 100, 0, 100, tile.getSliderValueObject());

	label = new GuiComponentLabel(5, 30, 100, 100, "Hello there!");

	tabOne.addComponent(label);
	tabs.addComponent(tabOne);
	tabs.addComponent(tabTwo);
	root.addComponent(tabs);
	root.addComponent(slider);
}
 
开发者ID:OpenMods,项目名称:ExampleMod,代码行数:20,代码来源:GuiExample.java

示例2: GuiDonationStation

import openmods.gui.component.GuiComponentLabel; //导入依赖的package包/类
public GuiDonationStation(ContainerDonationStation container) {
	super(container, 176, 172, "openblocks.gui.donationstation");

	root.addComponent((lblModName = new GuiComponentLabel(55, 31, 100, 10, "")));
	root.addComponent((lblAuthors = new GuiComponentLabel(55, 42, 200, 18, "").setScale(0.5f)));
	root.addComponent((buttonDonate = new GuiComponentTextButton(31, 60, 115, 13, 0xFFFFFF)).setText("Donate to the author"));

	buttonDonate.setListener((IMouseDownListener)(component, x, y, button) -> {
		if (!buttonDonate.isButtonEnabled()) return;

		String donationUrl = getContainer().getOwner().getDonationUrl();
		if (Strings.isNullOrEmpty(donationUrl)) return;

		URI uri = URI.create(donationUrl);

		if (Minecraft.getMinecraft().gameSettings.chatLinksPrompt) {
			displayedURI = uri;
			mc.displayGuiScreen(new GuiConfirmOpenLink(GuiDonationStation.this, displayedURI.toString(), PROMPT_REPLY_ACTION, false));
		} else {
			openURI(uri);
		}
	});
}
 
开发者ID:OpenMods,项目名称:OpenBlocks,代码行数:24,代码来源:GuiDonationStation.java

示例3: GuiItemDropper

import openmods.gui.component.GuiComponentLabel; //导入依赖的package包/类
public GuiItemDropper(ContainerItemDropper container) {
	super(container, 300, 167, "openblocks.gui.itemdropper");

	final TileEntityItemDropper owner = container.getOwner();
	final IItemDropper rpc = owner.createRpcProxy();

	root.addComponent(new GuiComponentLabel(85, 50, TranslationUtils.translateToLocal("openblocks.misc.dropper.use_redstone")));

	final int sliderSteps = (int)Config.maxItemDropSpeed * 10;
	final GuiComponentSlider slider = new GuiComponentSlider(70, 20, 120, 0, Config.maxItemDropSpeed, owner.getItemSpeed(), sliderSteps, true, TranslationUtils.translateToLocal("openblocks.misc.dropper.speed"));
	slider.setListener(value -> rpc.setItemSpeed(value));
	root.addComponent(slider);

	final GuiComponentCheckbox redstoneSwitch = new GuiComponentCheckbox(70, 50, owner.getUseRedstoneStrength());
	redstoneSwitch.setListener(value -> rpc.setUseRedstoneStrength(value));
	root.addComponent(redstoneSwitch);
}
 
开发者ID:OpenMods,项目名称:OpenBlocks,代码行数:18,代码来源:GuiItemDropper.java

示例4: TitledPage

import openmods.gui.component.GuiComponentLabel; //导入依赖的package包/类
public TitledPage(String title, String content) {
	{
		final String translatedTitle = TranslationUtils.translateToLocal(title);
		final GuiComponentLabel titleLabel = new GuiComponentLabel(0, 0, translatedTitle).setScale(BookScaleConfig.getPageTitleScale());
		addComponent(new GuiComponentHCenter(0, 12, getWidth()).addComponent(titleLabel));
	}

	{
		final String translatedContent = StringEscapeUtils.unescapeJava(TranslationUtils.translateToLocal(content));
		final GuiComponentLabel lblContent = new GuiComponentLabel(0, 0, getWidth() - 20, 300, translatedContent);

		lblContent.setScale(BookScaleConfig.getPageContentScale());
		lblContent.setAdditionalLineHeight(BookScaleConfig.getTitlePageSeparator());

		addComponent(new GuiComponentHCenter(0, 35, getWidth()).addComponent(lblContent));
	}
}
 
开发者ID:OpenMods,项目名称:OpenModsLib,代码行数:18,代码来源:TitledPage.java

示例5: createActionButton

import openmods.gui.component.GuiComponentLabel; //导入依赖的package包/类
protected BaseComponent createActionButton(int x, int y, final String link, Icon icon, String text, final IConfirmListener listener) {
	EmptyComposite result = new EmptyComposite(x, y, 50, 8);

	GuiComponentLabel label = new GuiComponentLabel(15, 2, TranslationUtils.translateToLocal(text));
	label.setScale(BookScaleConfig.getPageContentScale());
	result.addComponent(label);

	GuiComponentSprite image = new GuiComponentSprite(0, 0, icon);
	result.addComponent(image);

	result.setListener((IMouseDownListener)(component, clickX, clickY, button) -> {
		final Minecraft mc = Minecraft.getMinecraft();
		if (mc.gameSettings.chatLinksPrompt) {
			final GuiScreen prevGui = mc.currentScreen;
			mc.displayGuiScreen(new GuiConfirmOpenLink((response, id) -> {
				if (response) listener.onConfirm();
				mc.displayGuiScreen(prevGui);
			}, link, 0, false));
		} else {
			listener.onConfirm();
		}
	});

	return result;
}
 
开发者ID:OpenMods,项目名称:OpenModsLib,代码行数:26,代码来源:PageBase.java

示例6: createLabel

import openmods.gui.component.GuiComponentLabel; //导入依赖的package包/类
@Override
protected GuiComponentLabel createLabel(AutoSlots slot) {
	switch (slot) {
		case modifier:
		case tool:
			return new GuiComponentLabel(22, 82, TranslationUtils.translateToLocal("openblocks.gui.autoextract"));
		case output:
			return new GuiComponentLabel(22, 82, TranslationUtils.translateToLocal("openblocks.gui.autoeject"));
		case xp:
			return new GuiComponentLabel(22, 82, TranslationUtils.translateToLocal("openblocks.gui.autodrink"));
		default:
			throw MiscUtils.unhandledEnum(slot);

	}
}
 
开发者ID:OpenMods,项目名称:OpenBlocks,代码行数:16,代码来源:GuiAutoAnvil.java

示例7: addCustomizations

import openmods.gui.component.GuiComponentLabel; //导入依赖的package包/类
@Override
protected void addCustomizations(BaseComposite root) {
	final TileEntityAutoEnchantmentTable te = getContainer().getOwner();

	final ILevelChanger rpc = te.createClientRpcProxy(ILevelChanger.class);

	((GuiComponentPanel)root).setSlotRenderer(1, GuiComponentPanel.customIconSlot(LAPIS_SLOT, -1, -1));

	final GuiComponentSlider slider = new GuiComponentSlider(44, 39, 45, 1, 30, 1, true, TranslationUtils.translateToLocal("openblocks.gui.limit"));
	slider.setListener(value -> rpc.changePowerLimit(value.intValue()));

	addSyncUpdateListener(ValueCopyAction.create(te.getLevelProvider(), slider, Integer::doubleValue));

	root.addComponent(slider);

	final GuiComponentLabel maxPower = new GuiComponentLabel(40, 25, "0");
	maxPower.setMaxWidth(100);
	addSyncUpdateListener(ValueCopyAction.create(te.getAvailablePowerProvider(), value -> maxPower.setText(TranslationUtils.translateToLocalFormatted("openblocks.gui.available_power", value))));
	root.addComponent(maxPower);

	final GuiComponentTankLevel tankLevel = new GuiComponentTankLevel(140, 30, 17, 37, TileEntityAutoEnchantmentTable.MAX_STORED_LEVELS);
	tankLevel.setDisplayFluidNameInTooltip(false);
	addSyncUpdateListener(ValueCopyAction.create(te.getFluidProvider(), tankLevel.fluidReceiver(), LiquidXpUtils.FLUID_TO_LEVELS));
	root.addComponent(tankLevel);

	final GuiComponentToggleButton<VanillaEnchantLogic.Level> levelSelect = new GuiComponentToggleButton<>(16, 60, 0xFFFFFF, icons);
	levelSelect.setListener((IMouseDownListener)(component, x, y, button) -> {
		final VanillaEnchantLogic.Level currentValue = te.getSelectedLevelProvider().getValue();
		final Level[] values = VanillaEnchantLogic.Level.values();
		final VanillaEnchantLogic.Level nextValue = values[(currentValue.ordinal() + 1) % values.length];
		rpc.changeLevel(nextValue);
	});
	addSyncUpdateListener(ValueCopyAction.create(te.getSelectedLevelProvider(), levelSelect));
	root.addComponent(levelSelect);
}
 
开发者ID:OpenMods,项目名称:OpenBlocks,代码行数:36,代码来源:GuiAutoEnchantmentTable.java

示例8: createLabel

import openmods.gui.component.GuiComponentLabel; //导入依赖的package包/类
@Override
protected GuiComponentLabel createLabel(AutoSlots slot) {
	switch (slot) {
		case lapisInput:
		case toolInput:
			return new GuiComponentLabel(22, 82, TranslationUtils.translateToLocal("openblocks.gui.autoextract"));
		case output:
			return new GuiComponentLabel(22, 82, TranslationUtils.translateToLocal("openblocks.gui.autoeject"));
		case xp:
			return new GuiComponentLabel(22, 82, TranslationUtils.translateToLocal("openblocks.gui.autodrink"));
		default:
			throw MiscUtils.unhandledEnum(slot);

	}
}
 
开发者ID:OpenMods,项目名称:OpenBlocks,代码行数:16,代码来源:GuiAutoEnchantmentTable.java

示例9: createLabel

import openmods.gui.component.GuiComponentLabel; //导入依赖的package包/类
@Override
protected GuiComponentLabel createLabel(AutoSlots slot) {
	switch (slot) {
		case input:
			return new GuiComponentLabel(22, 82, TranslationUtils.translateToLocal("openblocks.gui.autoextract"));
		case output:
			return new GuiComponentLabel(22, 82, TranslationUtils.translateToLocal("openblocks.gui.autoeject"));
		case xp:
			return new GuiComponentLabel(22, 82, TranslationUtils.translateToLocal("openblocks.gui.autodrink"));
		default:
			throw MiscUtils.unhandledEnum(slot);

	}
}
 
开发者ID:OpenMods,项目名称:OpenBlocks,代码行数:15,代码来源:GuiXPBottler.java

示例10: StandardRecipePage

import openmods.gui.component.GuiComponentLabel; //导入依赖的package包/类
public StandardRecipePage(String title, String description, @Nonnull ItemStack resultingItem) {
	addComponent(new GuiComponentSprite(75, 40, iconArrow));
	addComponent(new GuiComponentItemStackSpinner(140, 30, resultingItem));

	{
		final IRecipe recipe = RecipeUtils.getFirstRecipeForItemStack(resultingItem);
		if (recipe != null) {
			ItemStack[][] input = RecipeUtils.getFullRecipeInput(recipe);
			if (input != null) addComponent(new GuiComponentCraftingGrid(10, 20, input, iconCraftingGrid));
		}
	}

	{
		String translatedTitle = TranslationUtils.translateToLocal(title);
		final GuiComponentLabel titleLabel = new GuiComponentLabel(0, 0, translatedTitle);
		titleLabel.setScale(BookScaleConfig.getPageTitleScale());
		addComponent(new GuiComponentHCenter(0, 2, getWidth()).addComponent(titleLabel));
	}

	{
		String translatedDescription = TranslationUtils.translateToLocal(description).replaceAll("\\\\n", "\n");
		GuiComponentLabel lblDescription = new GuiComponentLabel(10, 80, getWidth() - 5, 200, translatedDescription);
		lblDescription.setScale(BookScaleConfig.getPageContentScale());
		lblDescription.setAdditionalLineHeight(BookScaleConfig.getRecipePageSeparator());
		addComponent(lblDescription);
	}
}
 
开发者ID:OpenMods,项目名称:OpenModsLib,代码行数:28,代码来源:StandardRecipePage.java

示例11: SectionPage

import openmods.gui.component.GuiComponentLabel; //导入依赖的package包/类
public SectionPage(String name) {
	String txt = TranslationUtils.translateToLocal(name);
	GuiComponentLabel title = new GuiComponentLabel(0, 0, getWidth(), 40, txt);
	title.setScale(BookScaleConfig.getSectionTitleScale());

	addComponent(GuiComponentHCenter.wrap(0, 0, getWidth(),
			GuiComponentVCenter.wrap(0, 0, getHeight(),
					title)));
}
 
开发者ID:OpenMods,项目名称:OpenModsLib,代码行数:10,代码来源:SectionPage.java

示例12: GuiBigButton

import openmods.gui.component.GuiComponentLabel; //导入依赖的package包/类
public GuiBigButton(ContainerBigButton container) {
	super(container, 176, 182, "openblocks.gui.bigbutton");
	ticksLabel = new GuiComponentLabel(7, 75, 162, -1, createTickLabelContents());
	root.addComponent(ticksLabel);
}
 
开发者ID:OpenMods,项目名称:OpenBlocks,代码行数:6,代码来源:GuiBigButton.java

示例13: ChangelogPage

import openmods.gui.component.GuiComponentLabel; //导入依赖的package包/类
public ChangelogPage(String currentVersion, String section, List<String> lines) {
	final float scaleTitle = BookScaleConfig.getPageTitleScale();
	final float scaleContent = BookScaleConfig.getPageContentScale();
	final int lineSpace = BookScaleConfig.getTitlePageSeparator();

	section = TranslationUtils.translateToLocal(section);

	final GuiComponentLabel currentVersionLabel = new GuiComponentLabel(0, 0, section).setScale(scaleTitle);
	addComponent(new GuiComponentHCenter(0, 24, getWidth()).addComponent(currentVersionLabel));

	{
		final GuiComponentHBox titleLine = new GuiComponentHBox(0, 0);

		{
			prevVersionLabel = new GuiComponentLabel(0, 2, "");
			prevVersionLabel.setScale(BookScaleConfig.getPageContentScale());
			titleLine.addComponent(prevVersionLabel);
		}

		titleLine.addComponent(new EmptyComposite(0, 0, 0, 7));

		{
			final GuiComponentLabel centerVersionLabel = new GuiComponentLabel(0, 0, currentVersion);
			centerVersionLabel.setScale(scaleTitle);
			titleLine.addComponent(centerVersionLabel);
		}

		titleLine.addComponent(new EmptyComposite(0, 0, 0, 7));

		{
			nextVersionBookmark = new GuiComponentLabel(0, 2, "");
			nextVersionBookmark.setScale(BookScaleConfig.getPageContentScale());
			titleLine.addComponent(nextVersionBookmark);
		}

		addComponent(new GuiComponentHCenter(0, 12, getWidth()).addComponent(titleLine));
	}

	String contents = Joiner.on('\n').join(Iterables.transform(lines, value -> "\u00B7" + value));

	final GuiComponentLabel lblContent = new GuiComponentLabel(15, 40, getWidth() - 10, getHeight(), contents);
	lblContent.setScale(scaleContent);
	lblContent.setAdditionalLineHeight(lineSpace);
	addComponent(lblContent);
}
 
开发者ID:OpenMods,项目名称:OpenBlocks,代码行数:46,代码来源:ChangelogPage.java

示例14: createLabel

import openmods.gui.component.GuiComponentLabel; //导入依赖的package包/类
protected abstract GuiComponentLabel createLabel(E slot); 
开发者ID:OpenMods,项目名称:OpenModsLib,代码行数:2,代码来源:GuiConfigurableSlots.java


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