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


Java TextFieldEnder类代码示例

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


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

示例1: GuiBuffer

import com.enderio.core.client.gui.widget.TextFieldEnder; //导入依赖的package包/类
public GuiBuffer(@Nonnull InventoryPlayer par1InventoryPlayer, @Nonnull TileBuffer te) {
  super(te, new ContainerBuffer(par1InventoryPlayer, te), TEXTURE_FULL);
  hasInventory = te.hasInventory();
  hasPower = te.hasPower();

  redstoneButton.setPosition(153, 14);
  configB.setPosition(153, 32);

  if (hasPower) {
    int x = (isFull() ? 32 : 58);
    int y = guiTop + 28;

    maxInput = new TextFieldEnder(getFontRenderer(), x, y, 60, 12);
    y += 29;
    maxOutput = new TextFieldEnder(getFontRenderer(), x, y, 60, 12);

    textFields.add(maxInput);
    textFields.add(maxOutput);
    addDrawingElement(new PowerBar<TileBuffer>(te, this, 15, 13, 42) {
      @Override
      protected String getPowerOutputLabel(@Nonnull String rft) {
        return Lang.GUI_BUFFER_MAXIO.get(LangPower.RFt(getTileEntity().getMaxIO()));
      }
    });
  }
}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:27,代码来源:GuiBuffer.java

示例2: GuiSensor

import com.enderio.core.client.gui.widget.TextFieldEnder; //导入依赖的package包/类
public GuiSensor(InventoryPlayer par1InventoryPlayer, TileInventoryPanelSensor te) {
  super(te, new ContainerSensor(par1InventoryPlayer, te), "invPanelSensor");
  
  recipeButton.setYOrigin(recipeButton.getBounds().y + 19);
  redstoneButton.setIsVisible(false);
  configB.setYOrigin(5);
  
  int tfWidth = 42;
  int tfHeight = 14;
  int tfX = xSize - tfWidth - 6 - 20;
  int tfY = 34;
  startTF = new TextFieldEnder(getFontRenderer(), tfX, tfY, tfWidth, tfHeight);
  startTF.setCanLoseFocus(true);
  startTF.setMaxStringLength(6);
  startTF.setText(te.getStartCount() + "");
  startTF.setCharFilter(TextFieldEnder.FILTER_NUMERIC);
  textFields.add(startTF);

  stopTF = new TextFieldEnder(getFontRenderer(), tfX, tfY + tfHeight + 4, tfWidth, tfHeight);
  stopTF.setCanLoseFocus(true);
  stopTF.setMaxStringLength(6);
  stopTF.setText(te.getStopCount() + "");
  stopTF.setCharFilter(TextFieldEnder.FILTER_NUMERIC);
  textFields.add(stopTF);
    
}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:27,代码来源:GuiSensor.java

示例3: GuiLocationPrintout

import com.enderio.core.client.gui.widget.TextFieldEnder; //导入依赖的package包/类
private GuiLocationPrintout(@Nonnull TelepadTarget target, @Nonnull ItemStack stack, EntityEquipmentSlot slot, int paperSlot) {

    this.slot = slot;
    this.stack = stack;
    this.paperSlot = paperSlot;
    this.target = target;

    xSize = 176;
    ySize = 116;

    int tfWidth = 90;
    FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
    tf = new TextFieldEnder(fr, xSize / 2 - tfWidth / 2, 20, tfWidth, 16);
    tf.setMaxStringLength(32);

    okB = new TooltipButton(this, 0, xSize - 30, ySize - 30, 20, 20, "Ok");
  }
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:18,代码来源:GuiLocationPrintout.java

示例4: initGui

import com.enderio.core.client.gui.widget.TextFieldEnder; //导入依赖的package包/类
@Override
public void initGui() {
  super.initGui();
  fixupGuiPosition();
  for (IGuiOverlay overlay : overlays) {
    overlay.init(this);
  }
  for (TextFieldEnder f : textFields) {
    f.init(this);
  }
}
 
开发者ID:SleepyTrousers,项目名称:EnderCore,代码行数:12,代码来源:GuiContainerBase.java

示例5: getIntFromTextBox

import com.enderio.core.client.gui.widget.TextFieldEnder; //导入依赖的package包/类
private int getIntFromTextBox(TextFieldEnder tf) {
  String text = tf.getText();
  if ("".equals(text) || "-".equals(text)) {
    return 0;
  }
  return Integer.parseInt(text);
}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:8,代码来源:GuiTelePad.java

示例6: onTextFieldChanged

import com.enderio.core.client.gui.widget.TextFieldEnder; //导入依赖的package包/类
@Override
protected void onTextFieldChanged(TextFieldEnder tf, String old) {
  if (tf == tfFilter && btnSync.isSelected() && tfFilter.isFocused()) {
    if (Loader.isModLoaded("NotEnoughItems")) {
      updateNEI(tfFilter.getText());
    } else if (JeiAccessor.isJeiRuntimeAvailable()) {
      updateToJEI(tfFilter.getText());
    }
  }
}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:11,代码来源:GuiInventoryPanel.java

示例7: setText

import com.enderio.core.client.gui.widget.TextFieldEnder; //导入依赖的package包/类
protected final void setText(TextFieldEnder tf, String newText) {
  String old = tf.getText();
  tf.setText(newText);
  onTextFieldChanged(tf, old);
}
 
开发者ID:SleepyTrousers,项目名称:EnderCore,代码行数:6,代码来源:GuiContainerBase.java

示例8: mouseClicked

import com.enderio.core.client.gui.widget.TextFieldEnder; //导入依赖的package包/类
@Override
protected void mouseClicked(int x, int y, int button) {
  for (GuiTextField f : textFields) {
    f.mouseClicked(x, y, button);
  }
  if (!scrollbars.isEmpty()) {
    if (draggingScrollbar != null) {
      draggingScrollbar.mouseClicked(x, y, button);
      return;
    }
    for (VScrollbar vs : scrollbars) {
      if (vs.mouseClicked(x, y, button)) {
        draggingScrollbar = vs;
        return;
      }
    }
  }
  if (!ghostSlotHandler.getGhostSlots().isEmpty()) {
    GhostSlot slot = getGhostSlot(x, y);
    if (slot != null) {
      ghostSlotClicked(slot, x, y, button);
      return;
    }
  }
  // Right click field clearing
  if (button == 1) {
    for (TextFieldEnder tf : textFields) {
      if (tf.contains(x, y)) {
        setText(tf, "");
      }
    }
  }
  // Button events for non-left-clicks
  if (button >= 1) {
    for (Object obj : buttonList) {
      if (obj instanceof IconButton) {
        IconButton btn = (IconButton) obj;
        if (btn.mousePressedButton(mc, x, y, button)) {
          btn.func_146113_a(this.mc.getSoundHandler());
          actionPerformedButton(btn, button);
        }
      }
    }
  }
  super.mouseClicked(x, y, button);
}
 
开发者ID:SleepyTrousers,项目名称:EnderCore,代码行数:47,代码来源:GuiContainerBase.java

示例9: GuiTravelAccessable

import com.enderio.core.client.gui.widget.TextFieldEnder; //导入依赖的package包/类
public GuiTravelAccessable(@Nonnull T te, @Nonnull ContainerTravelAccessable container) {
  super(container, "travel_accessable");
  this.te = te;
  this.world = container.world;

  publicStr = Lang.GUI_AUTH_PUBLIC.get();
  privateStr = Lang.GUI_AUTH_PRIVATE.get();
  protectedStr = Lang.GUI_AUTH_PROTECTED.get();

  FontRenderer fr = Minecraft.getMinecraft().fontRenderer;

  tf = new TextFieldEnder(fr, 28, 10, 90, 16);

  col1x = 88;
  col0x = (col1x - fr.getStringWidth(protectedStr) / 2) / 2;
  int tmp = (col1x + fr.getStringWidth(protectedStr) / 2);
  col2x = tmp + (176 - tmp) / 2;

  int x = 0;
  int y = 50;

  x = col0x - 8;
  privateCB = new CheckBox(this, ID_PRIVATE, x, y);
  privateCB.setSelected(te.getAccessMode() == AccessMode.PRIVATE);

  x = col1x - 8;
  protectedCB = new CheckBox(this, ID_PROTECTED, x, y);
  protectedCB.setSelected(te.getAccessMode() == AccessMode.PROTECTED);

  x = col2x - 8;
  publicCB = new CheckBox(this, ID_PUBLIC, x, y);
  publicCB.setSelected(te.getAccessMode() == AccessMode.PUBLIC);

  visibleCB = new ToggleButton(this, -1, 150, 10, IconEIO.VISIBLE_NO, IconEIO.VISIBLE_YES);
  visibleCB.setSelected(te.isVisible());
  visibleCB.setToolTip(Lang.GUI_AUTH_VISIBLE.getLines().toArray(new String[0]));

  ySize = 185;

  textFields.add(tf);
}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:42,代码来源:GuiTravelAccessable.java

示例10: GuiTelePad

import com.enderio.core.client.gui.widget.TextFieldEnder; //导入依赖的package包/类
public GuiTelePad(@Nonnull InventoryPlayer playerInv, final @Nonnull TileTelePad te) {
  super(new ContainerTelePad(playerInv, te), "tele_pad");
  this.te = te;
  ySize = 220;

  addToolTip(new GuiToolTip(new Rectangle(powerX, powerY, 10, powerScale), "") {
    @Override
    protected void updateText() {
      text.clear();
      updatePowerBarTooltip(text);
    }
  });

  addToolTip(new GuiToolTip(new Rectangle(progressX, progressY, progressScale, 10), "") {
    @Override
    protected void updateText() {
      text.clear();
      text.add(Math.round(GuiTelePad.this.te.getProgress() * 100) + "%");
    }
  });

  if (TelePadConfig.telepadFluidUse.get() > 0) {
    addToolTip(new GuiToolTip(RECTANGLE_TANK, "") {
      @Override
      protected void updateText() {
        text.clear();
        text.add(Lang.GUI_TELEPAD_TANK.get());
        text.add(LangFluid.MB(te.getTank()));
      }
    });
  }

  FontRenderer fr = Minecraft.getMinecraft().fontRenderer;

  int x = 48;
  int y = 24;
  int tfHeight = 12;
  int tfWidth = xSize - x * 2;
  xTF = new TextFieldEnder(fr, x, y, tfWidth, tfHeight, TextFieldEnder.FILTER_NUMERIC);
  yTF = new TextFieldEnder(fr, x, y + xTF.height + 2, tfWidth, tfHeight, TextFieldEnder.FILTER_NUMERIC);
  zTF = new TextFieldEnder(fr, x, y + (xTF.height * 2) + 4, tfWidth, tfHeight, TextFieldEnder.FILTER_NUMERIC);
  dimTF = new TextFieldEnder(fr, x, y + (xTF.height * 3) + 6, tfWidth, tfHeight, TextFieldEnder.FILTER_NUMERIC);

  xTF.setText(Integer.toString(te.getX()));
  yTF.setText(Integer.toString(te.getY()));
  zTF.setText(Integer.toString(te.getZ()));
  dimTF.setText(Integer.toString(te.getTargetDim()));

  xTF.setCanLoseFocus(!TelePadConfig.telepadLockCoords.get());
  yTF.setCanLoseFocus(!TelePadConfig.telepadLockCoords.get());
  zTF.setCanLoseFocus(!TelePadConfig.telepadLockCoords.get());
  dimTF.setCanLoseFocus(!TelePadConfig.telepadLockDimension.get());

  textFields.addAll(Lists.newArrayList(xTF, yTF, zTF, dimTF));

  switchButton = new ToggleTravelButton(this, ID_SWITCH_BUTTON, SWITCH_X, SWITCH_Y, IconEIO.IO_WHATSIT);
  switchButton.setToolTip(Lang.GUI_TELEPAD_TO_TRAVEL.get());
}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:59,代码来源:GuiTelePad.java

示例11: GuiPowerMonitor

import com.enderio.core.client.gui.widget.TextFieldEnder; //导入依赖的package包/类
public GuiPowerMonitor(@Nonnull InventoryPlayer par1InventoryPlayer, @Nonnull TilePowerMonitor te) {
  super(te, new ContainerPowerMonitor(par1InventoryPlayer, te), "pmon", "pmon2");

  plus = new InvisibleButton(this, 1, 154, 28);
  plus.setToolTip("+");
  minus = new InvisibleButton(this, 2, 154, 52);
  minus.setToolTip("-");

  if (!te.isAdvanced()) {
    tab = Tab.STAT;
  }

  engineControlEnabled = new CheckBox(this, 4, 0, 0);
  engineControlEnabled.setSelectedToolTip(EnderIO.lang.localize("gui.enabled"));
  engineControlEnabled.setUnselectedToolTip(EnderIO.lang.localize("gui.disabled"));

  engineControlStart = new TextFieldEnder(getFontRenderer(), 0, 0, 28, 14);
  engineControlStart.setCanLoseFocus(true);
  engineControlStart.setMaxStringLength(3);
  textFields.add(engineControlStart);

  engineControlStop = new TextFieldEnder(getFontRenderer(), 0, 0, 28, 14);
  engineControlStop.setCanLoseFocus(true);
  engineControlStop.setMaxStringLength(3);
  textFields.add(engineControlStop);

  addToolTip(tooltipConduitStorage = new GuiToolTip(new Rectangle(0, 0, 0, 0), EnderIO.lang.localize("gui.power_monitor.mon_heading1")));
  addToolTip(tooltipCapacitorBankStorage = new GuiToolTip(new Rectangle(0, 0, 0, 0), EnderIO.lang.localize("gui.power_monitor.mon_heading2")));
  addToolTip(tooltipMachineBuffers = new GuiToolTip(new Rectangle(0, 0, 0, 0), EnderIO.lang.localize("gui.power_monitor.mon_heading3")));
  addToolTip(tooltipAverageOutput = new GuiToolTip(new Rectangle(0, 0, 0, 0), EnderIO.lang.localize("gui.power_monitor.mon_heading4")));
  addToolTip(tooltipAverageInput = new GuiToolTip(new Rectangle(0, 0, 0, 0), EnderIO.lang.localize("gui.power_monitor.mon_heading5")));

  addDrawingElement(new PowerBar<TilePowerMonitor>(te, this, 7, 10, 4, 66) {
    @Override
    public void drawGuiContainerBackgroundLayer(float partialTicks, int par2, int par3) {
      if (tab == Tab.GRAPH) {
        super.drawGuiContainerBackgroundLayer(partialTicks, par2, par3);
      }
    }
  });
}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:42,代码来源:GuiPowerMonitor.java

示例12: drawControls

import com.enderio.core.client.gui.widget.TextFieldEnder; //导入依赖的package包/类
private void drawControls(int sx, int sy) {
  FontRenderer fr = getFontRenderer();
  int textColor = ColorUtil.getRGB(engineControlEnabled.isSelected() ? Color.black : Color.darkGray);

  int x0 = sx + TEXT_MARGIN_LEFT;
  int y0 = sy + TEXT_MARGIN_TOP;

  String engineTxt1 = EnderIO.lang.localize("gui.power_monitor.engine_section1").trim(); // Emit signal when storage less
  String engineTxt2 = EnderIO.lang.localize("gui.power_monitor.engine_section2").trim(); // than
  String engineTxt3 = EnderIO.lang.localize("gui.power_monitor.engine_section3").trim(); // % full.
  String engineTxt4 = EnderIO.lang.localize("gui.power_monitor.engine_section4").trim(); // Stop when storage greater than
  String engineTxt5 = EnderIO.lang.localize("gui.power_monitor.engine_section5").trim(); // or equal to

  List<Object> elems = new ArrayList<Object>();
  elems.add(engineControlEnabled);
  elems.addAll(Arrays.asList(engineTxt1.split("(\\s+)")));
  elems.addAll(Arrays.asList(engineTxt2.split("(\\s+)")));
  elems.add(engineControlStart);
  elems.addAll(Arrays.asList(engineTxt3.split("(\\s+)")));
  elems.addAll(Arrays.asList(engineTxt4.split("(\\s+)")));
  elems.addAll(Arrays.asList(engineTxt5.split("(\\s+)")));
  elems.add(engineControlStop);
  elems.addAll(Arrays.asList(engineTxt3.split("(\\s+)")));

  int x = 0, y = 0;

  for (Object elem : elems) {
    int elemWidth = 0;
    if (elem instanceof String) {
      elemWidth = fr.getStringWidth((String) elem);
    } else if (elem instanceof CheckBox) {
      elemWidth = ((CheckBox) elem).width;
    } else if (elem instanceof TextFieldEnder) {
      elemWidth = ((TextFieldEnder) elem).width;
    }

    if (x + elemWidth > TEXT_WIDTH) {
      x = 0;
      y += CONTROL_LF_PX;
      if (" ".equals(elem)) {
        continue;
      }
    }

    if (elem instanceof String) {
      fr.drawString((String) elem, x0 + x, y0 + y + TEXT_Y_OFFSET, textColor);
    } else if (elem instanceof CheckBox) {
      ((CheckBox) elem).xPosition = x0 + x;
      ((CheckBox) elem).yPosition = y0 + y;
    } else if (elem instanceof TextFieldEnder) {
      ((TextFieldEnder) elem).xPosition = x0 + x;
      ((TextFieldEnder) elem).yPosition = y0 + y;
    }

    x += elemWidth + fr.getStringWidth(" ");
  }

}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:59,代码来源:GuiPowerMonitor.java

示例13: onTextFieldChanged

import com.enderio.core.client.gui.widget.TextFieldEnder; //导入依赖的package包/类
protected void onTextFieldChanged(TextFieldEnder tf, String old) {

  }
 
开发者ID:SleepyTrousers,项目名称:EnderCore,代码行数:4,代码来源:GuiContainerBase.java


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