當前位置: 首頁>>代碼示例>>Java>>正文


Java GuiButton類代碼示例

本文整理匯總了Java中net.minecraft.client.gui.GuiButton的典型用法代碼示例。如果您正苦於以下問題:Java GuiButton類的具體用法?Java GuiButton怎麽用?Java GuiButton使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


GuiButton類屬於net.minecraft.client.gui包,在下文中一共展示了GuiButton類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: actionPerformed

import net.minecraft.client.gui.GuiButton; //導入依賴的package包/類
/**
 * Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
 */
protected void actionPerformed(GuiButton button)
{
    if (button.enabled)
    {
        if (button.id < 200 && button instanceof GuiOptionButton)
        {
            this.settings.setOptionValue(((GuiOptionButton)button).returnEnumOptions(), 1);
            button.displayString = this.settings.getKeyBinding(GameSettings.Options.getEnumOptions(button.id));
        }

        if (button.id == 200)
        {
            this.mc.gameSettings.saveOptions();
            this.mc.displayGuiScreen(this.prevScreen);
        }

        if (button.id != GameSettings.Options.AA_LEVEL.ordinal())
        {
            ScaledResolution scaledresolution = new ScaledResolution(this.mc);
            this.setWorldAndResolution(this.mc, scaledresolution.getScaledWidth(), scaledresolution.getScaledHeight());
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:27,代碼來源:GuiQualitySettingsOF.java

示例2: actionPerformed

import net.minecraft.client.gui.GuiButton; //導入依賴的package包/類
/**
 * Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
 */
protected void actionPerformed(GuiButton button) throws IOException
{
    if (button.id == 0)
    {
        this.mc.displayGuiScreen(new GuiAchievements(this, this.mc.thePlayer.getStatFileWriter()));
    }

    if (button.id == 1)
    {
        this.mc.displayGuiScreen(new GuiStats(this, this.mc.thePlayer.getStatFileWriter()));
    }

    if (button.id == 101)
    {
        tabPage = Math.max(tabPage - 1, 0);
    }
    else if (button.id == 102)
    {
        tabPage = Math.min(tabPage + 1, maxPages);
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:25,代碼來源:GuiContainerCreative.java

示例3: initGui

import net.minecraft.client.gui.GuiButton; //導入依賴的package包/類
@Override
public void initGui() {
	super.initGui();

	this.nameField = new GuiTextField(NAME_FIELD, this.fontRendererObj, this.guiLeft + 11, this.guiTop + 120, 211, 18);
	this.nameField.setMaxStringLength(23);
	this.nameField.setText("");
	this.nameField.setFocused(false);
	this.nameField.setVisible(false);
	this.addControl(this.nameField);
	
	this.searchField = new GuiTextField(SEARCH_FIELD, this.fontRendererObj, this.guiLeft + 11, this.guiTop + 5, 211, 18);
	this.searchField.setMaxStringLength(23);
	this.searchField.setText("");
	this.searchField.setFocused(true);
	this.searchField.setVisible(true);
	this.addControl(this.searchField);
	
	this.securedBtn = new GuiButton(SECURED_BUTTON, this.guiLeft + 50, this.guiTop + 167, 100, 18, "Not Secured");
	this.securedBtn.visible = false;
	this.addControl(this.securedBtn);
}
 
開發者ID:astronautlabs,項目名稱:rezolve,代碼行數:23,代碼來源:RemoteShellGuiContainer.java

示例4: drawGuiContainerForegroundLayer

import net.minecraft.client.gui.GuiButton; //導入依賴的package包/類
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {

    GlStateManager.pushMatrix();
   		GlStateManager.translate(-guiLeft, -guiTop, 0);
		for (Gui control : this.controls) {
			if (control instanceof GuiTextField) {
				((GuiTextField)control).drawTextBox();
			} else if (control instanceof GuiButton) {
				((GuiButton)control).drawButton(this.mc, mouseX, mouseY);
			}
		}
   	GlStateManager.popMatrix();		
	
	super.drawGuiContainerForegroundLayer(mouseX, mouseY);
}
 
開發者ID:astronautlabs,項目名稱:rezolve,代碼行數:17,代碼來源:GuiContainerBase.java

示例5: initGui

import net.minecraft.client.gui.GuiButton; //導入依賴的package包/類
@Override
public void initGui() {
    super.initGui();

    int xStart = (width - xSize) / 2;
    int yStart = (height - ySize) / 2;

    statusStat = addAnimatedStat("Security Status", new ItemStack(Blockss.SECURITY_STATION), 0xFFFFAA00, false);
    accessStat = addAnimatedStat("Shared Users", new ItemStack(Items.SKULL, 1, 3), 0xFF005500, false);

    Rectangle accessButtonRectangle = accessStat.getButtonScaledRectangle(145, 10, 20, 20);
    addButton = getButtonFromRectangle(1, accessButtonRectangle, "+");
    rebootButton = new GuiButton(2, xStart + 110, yStart + 20, 60, 20, "Reboot");
    sharedUserTextField = getTextFieldFromRectangle(accessStat.getButtonScaledRectangle(20, 15, 120, 10));
    accessStat.addWidget(sharedUserTextField);
    accessStat.addWidget(addButton);

    buttonList.add(new GuiButton(3, guiLeft + 108, guiTop + 103, 64, 20, I18n.format("gui.securityStation.test")));
    buttonList.add(rebootButton);
    buttonList.add(new GuiButton(-1, guiLeft + 108, guiTop + 125, 64, 20, I18n.format("gui.universalSensor.button.showRange")));

    updateUserRemoveButtons();

    nodeHandler = new NetworkConnectionBackground(this, te, xStart + 25, yStart + 30, 18, 0xFF2222FF);
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:26,代碼來源:GuiSecurityStationInventory.java

示例6: actionPerformed

import net.minecraft.client.gui.GuiButton; //導入依賴的package包/類
@Override
protected void actionPerformed(GuiButton button) throws IOException
{
	if(!button.enabled)
		return;
	
	WurstClient wurst = WurstClient.INSTANCE;
	switch(button.id)
	{
		case 0:
		feature.doPrimaryAction();
		primaryButton.displayString = feature.getPrimaryAction();
		break;
		case 1:
		MiscUtils.openLink("https://www.wurstclient.net/wiki/"
			+ feature.getHelpPage() + "/");
		wurst.navigator.analytics.trackEvent("help", "open",
			feature.getName());
		break;
	}
	
	wurst.navigator.addPreference(feature.getName());
	ConfigFiles.NAVIGATOR.save();
}
 
開發者ID:Wurst-Imperium,項目名稱:Wurst-MC-1.12,代碼行數:25,代碼來源:NavigatorFeatureScreen.java

示例7: mouseClicked

import net.minecraft.client.gui.GuiButton; //導入依賴的package包/類
/**
 * Called when the mouse is clicked. Args : mouseX, mouseY, clickedButton
 */
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException
{
    super.mouseClicked(mouseX, mouseY, mouseButton);

    if (mouseButton == 1)
    {
        GuiButton guibutton = this.getSelectedButton(mouseX, mouseY);

        if (guibutton instanceof GuiButtonShaderOption)
        {
            GuiButtonShaderOption guibuttonshaderoption = (GuiButtonShaderOption)guibutton;
            ShaderOption shaderoption = guibuttonshaderoption.getShaderOption();

            if (shaderoption.isChanged())
            {
                guibuttonshaderoption.playPressSound(this.mc.getSoundHandler());
                shaderoption.resetValue();
                this.changed = true;
                this.updateAllButtons();
            }
        }
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:27,代碼來源:GuiShaderOptions.java

示例8: actionPerformed

import net.minecraft.client.gui.GuiButton; //導入依賴的package包/類
protected final void actionPerformed(GuiButton button) {
    if (button.enabled) {
        switch (button.id) {
            case 0:
                if (StringUtils.isNotEmpty(urlBox.getText())) {
                    Thread t = new InstallThread(urlBox.getText());
                    t.setDaemon(true);
                    t.start();
                } else {
                    this.message = "Enter a valid url!";
                }
                break;
            case 1:
                this.mc.displayGuiScreen(this.prevScreen);
        }

    }
}
 
開發者ID:WurstSDK-Team,項目名稱:WurstSDK,代碼行數:19,代碼來源:GuiInstallScreen.java

示例9: initGui

import net.minecraft.client.gui.GuiButton; //導入依賴的package包/類
@Override
public void initGui() {
    super.initGui();
    buttonList.clear();
    upgradePages.clear();
    upgradePageNames.clear();
    addPages();
    for (int i = 0; i < upgradePages.size(); i++) {
        GuiButton button = new GuiButton(100 + i, 210, 20 + i * 22, 200, 20, upgradePages.get(i).getPageName());
        if (page == i) button.enabled = false;
        buttonList.add(button);
    }
    if (page > upgradePages.size() - 1) {
        page = upgradePages.size() - 1;
    }
    GuiKeybindCheckBox checkBox = new GuiKeybindCheckBox(100, 40, 12, 0xFFFFFFFF,
            I18n.format("gui.enableModule", I18n.format("pneumaticHelmet.upgrade." + upgradePageNames.get(page))),
            "pneumaticHelmet.upgrade." + upgradePageNames.get(page));
    if (upgradePages.get(page).canBeTurnedOff()) addWidget(checkBox);
    upgradePages.get(page).initGui(this);
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:22,代碼來源:GuiHelmetMainScreen.java

示例10: initGui

import net.minecraft.client.gui.GuiButton; //導入依賴的package包/類
@Override
public void initGui()
{
	buttonList.clear();
	buttonList.add(new GuiButton(0, width / 2 - 100, height / 4 + 144 - 16,
		200, 20, "Back"));
	buttonList.add(new GuiButton(1, width / 2 - 79, height / 4 + 24 - 16,
		158, 20, "Zoom Key: " + Keyboard
			.getKeyName(WurstClient.INSTANCE.options.zoom.keybind)));
	buttonList.add(new GuiButton(2, width / 2 - 79, height / 4 + 72 - 16,
		50, 20, "More"));
	buttonList.add(new GuiButton(3, width / 2 - 25, height / 4 + 72 - 16,
		50, 20, "Less"));
	buttonList.add(new GuiButton(4, width / 2 + 29, height / 4 + 72 - 16,
		50, 20, "Default"));
	buttonList.add(new GuiButton(5, width / 2 - 79, height / 4 + 96 - 16,
		158, 20, "Use Mouse Wheel: "
			+ (WurstClient.INSTANCE.options.zoom.scroll ? "ON" : "OFF")));
	WurstClient.INSTANCE.analytics.trackPageView("/options/keybind-manager",
		"Keybind Manager");
}
 
開發者ID:Wurst-Imperium,項目名稱:Wurst-MC-1.12,代碼行數:22,代碼來源:GuiZoomManager.java

示例11: actionPerformed

import net.minecraft.client.gui.GuiButton; //導入依賴的package包/類
@Override
public void actionPerformed(GuiButton gui){
    switch (gui.id){
        case BUTTON_START_PROFILE_ID:
            startProfile();
            break;
        case BUTTON_SHOW_TOGGLE:
            if(lagOverlayGui.isShowing.get()) {
                lagOverlayGui.hide();
                Minecraft.getMinecraft().displayGuiScreen(null);
            }else{
                lagOverlayGui.show();
                Minecraft.getMinecraft().displayGuiScreen(null);
            }
            break;
        case BUTTON_ANALYZE_RESULTS:
            analyzeResults();
            break;
        case BUTTON_DONATE:
            DonateButton.donate();
            break;
        case BUTTON_OPTIONS:
            mc.displayGuiScreen(new GuiInGameConfig(this));
            break;
    }
}
 
開發者ID:TerminatorNL,項目名稱:LagGoggles,代碼行數:27,代碼來源:GuiProfile.java

示例12: initGui

import net.minecraft.client.gui.GuiButton; //導入依賴的package包/類
@Override
public void initGui()
{
	buttonList.add(new GuiButton(0, width / 2 - 150, height / 3 * 2, 100,
		20, "MC 1.12"));
	buttonList.add(new GuiButton(1, width / 2 - 50, height / 3 * 2, 100, 20,
		"MC 1.12.1"));
	buttonList.add(new GuiButton(2, width / 2 + 50, height / 3 * 2, 100, 20,
		"MC 1.12.2"));
	
	buttonList.add(
		new GuiButton(-1, width / 2 - 100, height / 3 * 2 + 40, "Cancel"));
	
	int version = WurstClient.INSTANCE.options.mc112x_compatibility;
	if(version >= 0 && version < buttonList.size() - 1)
		buttonList.get(version).enabled = false;
}
 
開發者ID:Wurst-Imperium,項目名稱:Wurst-MC-1.12,代碼行數:18,代碼來源:Gui1121Mode.java

示例13: initGui

import net.minecraft.client.gui.GuiButton; //導入依賴的package包/類
/**
 * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
 * window resizes, the buttonList is cleared beforehand.
 */
public void initGui()
{
    int i = this.width / 3;
    int j = i - 130;
    this.buttonList.add(new GuiButton(1, i * 0 + j / 2, this.height - 70, 130, 20, I18n.format("stream.userinfo.timeout", new Object[0])));
    this.buttonList.add(new GuiButton(0, i * 1 + j / 2, this.height - 70, 130, 20, I18n.format("stream.userinfo.ban", new Object[0])));
    this.buttonList.add(new GuiButton(2, i * 2 + j / 2, this.height - 70, 130, 20, I18n.format("stream.userinfo.mod", new Object[0])));
    this.buttonList.add(new GuiButton(5, i * 0 + j / 2, this.height - 45, 130, 20, I18n.format("gui.cancel", new Object[0])));
    this.buttonList.add(new GuiButton(3, i * 1 + j / 2, this.height - 45, 130, 20, I18n.format("stream.userinfo.unban", new Object[0])));
    this.buttonList.add(new GuiButton(4, i * 2 + j / 2, this.height - 45, 130, 20, I18n.format("stream.userinfo.unmod", new Object[0])));
    int k = 0;

    for (IChatComponent ichatcomponent : this.field_152332_r)
    {
        k = Math.max(k, this.fontRendererObj.getStringWidth(ichatcomponent.getFormattedText()));
    }

    this.field_152334_t = this.width / 2 - k / 2;
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:24,代碼來源:GuiTwitchUserMode.java

示例14: actionPerformed

import net.minecraft.client.gui.GuiButton; //導入依賴的package包/類
@Override
protected void actionPerformed(GuiButton button) throws IOException {
    super.actionPerformed(button);
    if (hasBackButton() && back == button) {
        onBackButton();
    }
    if (hasPageRight() && right == button) {
        onRightButton();
    }
    if (hasPageLeft() && left == button) {
        onLeftButton();
    }
    if (button instanceof CategoryEntryButton) {
        for (BookCategory category : BookCategory.values()) {
            for (ResourceLocation location : category.getEntries().keySet()) {
                if (((CategoryEntryButton) button).getEntry().equals(category.getEntries().get(location))) {
                    this.mc.displayGuiScreen(new GUIBookPage(this, this, category.getEntries().get(location)));
                }
            }
        }
    }
}
 
開發者ID:Buuz135,項目名稱:Industrial-Foregoing,代碼行數:23,代碼來源:GUIBookBase.java

示例15: actionPerformed

import net.minecraft.client.gui.GuiButton; //導入依賴的package包/類
@Override
protected void actionPerformed(GuiButton button) {
    if (getPermission(button.id) != null)
        //noinspection ConstantConditions
        logger.info("Button-action id: " + button.id + " text: " + button.displayString + " permission: " + getPermission(button.id).getName());
    if (button.id == 0) {
        ((WurstSDK) SDK.getClient()).saveConfig();
        mc.displayGuiScreen(parent);
        return;
    } else {
        if (button.displayString.equals("Enable")) {
            ((WurstSDK) SDK.getClient()).getConfig().change(plugin, getPermission(button.id), true, this);
        } else {
            ((WurstSDK) SDK.getClient()).getConfig().change(plugin, getPermission(button.id), false, this);
        }
        ((WurstSDK) SDK.getClient()).saveConfig();
    }
    mc.displayGuiScreen(new GuiPluginInfo(plugin, parent));
}
 
開發者ID:WurstSDK-Team,項目名稱:WurstSDK,代碼行數:20,代碼來源:GuiPluginInfo.java


注:本文中的net.minecraft.client.gui.GuiButton類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。