Java Code Examples for net.minecraft.client.gui.GuiScreen#getClipboardString()
The following examples show how to use
net.minecraft.client.gui.GuiScreen#getClipboardString() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TextField.java From NotEnoughItems with MIT License | 6 votes |
@Override public boolean handleKeyPress(int keyID, char keyChar) { if (!focused()) return false; if (keyID == Keyboard.KEY_BACK) { if (text.length() > 0) { setText(text.substring(0, text.length() - 1)); backdowntime = System.currentTimeMillis(); } } else if (keyID == Keyboard.KEY_RETURN || keyID == Keyboard.KEY_ESCAPE) { setFocus(false); onExit(); } else if (keyChar == 22)//paste { String pastestring = GuiScreen.getClipboardString(); if (pastestring == null) pastestring = ""; if (isValid(text + pastestring)) setText(text + pastestring); } else if (isValid(text + keyChar)) setText(text + keyChar); return true; }
Example 2
Source File: SaveLoadButton.java From NotEnoughItems with MIT License | 5 votes |
@Override public boolean handleKeyPress(int keyID, char keyChar) { if (!focused) { return false; } if (keyID == Keyboard.KEY_BACK) { if (label.length() > 0) { label = label.substring(0, label.length() - 1); onTextChange(); backdowntime = System.currentTimeMillis(); } } else if (keyID == Keyboard.KEY_RETURN) { focused = false; } else if (keyChar == 22)//paste { String pastestring = GuiScreen.getClipboardString(); if (pastestring == null) { pastestring = ""; } label = label + pastestring; onTextChange(); } else if (ChatAllowedCharacters.isAllowedCharacter(keyChar)) { label = label + keyChar; onTextChange(); } return true; }
Example 3
Source File: TextField.java From NotEnoughItems with MIT License | 5 votes |
@Override public boolean handleKeyPress(int keyID, char keyChar) { if (!focused()) { return false; } if (keyID == Keyboard.KEY_BACK) { if (text.length() > 0) { setText(text.substring(0, text.length() - 1)); backdowntime = System.currentTimeMillis(); } } else if (keyID == Keyboard.KEY_RETURN || keyID == Keyboard.KEY_ESCAPE) { setFocus(false); onExit(); } else if (keyChar == 22) {//paste String pastestring = GuiScreen.getClipboardString(); if (pastestring == null) { pastestring = ""; } if (isValid(text + pastestring)) { setText(text + pastestring); } } else if (isValid(text + keyChar)) { setText(text + keyChar); } return true; }
Example 4
Source File: SaveLoadButton.java From NotEnoughItems with MIT License | 5 votes |
@Override public boolean handleKeyPress(int keyID, char keyChar) { if(!focused) return false; if(keyID == Keyboard.KEY_BACK) { if(label.length() > 0) { label = label.substring(0, label.length() - 1); onTextChange(); backdowntime = System.currentTimeMillis(); } } else if(keyID == Keyboard.KEY_RETURN) { focused = false; } else if(keyChar == 22)//paste { String pastestring = GuiScreen.getClipboardString(); if(pastestring == null) pastestring = ""; label = label + pastestring; onTextChange(); } else if(ChatAllowedCharacters.isAllowedCharacter(keyChar)) { label = label + keyChar; onTextChange(); } return true; }
Example 5
Source File: GuiCCTextField.java From CodeChickenCore with MIT License | 5 votes |
@Override public void keyTyped(char c, int keycode) { if(!isEnabled || !isFocused) return; /*if(c == '\t')//tab { parentGuiScreen.selectNextField(); }*/ if(c == '\026')//paste { String s = GuiScreen.getClipboardString(); if(s == null || s.equals("")) return; for(int i = 0; i < s.length(); i++) { if(text.length() == maxStringLength) return; char tc = s.charAt(i); if(canAddChar(tc)) setText(text + tc); } } if(keycode == Keyboard.KEY_RETURN) { setFocused(false); sendAction(actionCommand, getText()); } if(keycode == Keyboard.KEY_BACK && text.length() > 0) setText(text.substring(0, text.length() - 1)); if((text.length() < maxStringLength || maxStringLength == 0) && canAddChar(c)) setText(text + c); }
Example 6
Source File: WrapperGuiScreen.java From ClientBase with MIT License | 4 votes |
public static String getClipboardString() { return GuiScreen.getClipboardString(); }