Java Code Examples for net.minecraft.client.gui.widget.TextFieldWidget#setSelected()

The following examples show how to use net.minecraft.client.gui.widget.TextFieldWidget#setSelected() . 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: EnterProfileNameScreen.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void init()
{
	int x1 = width / 2 - 100;
	int y1 = 60;
	int y2 = height / 3 * 2;
	
	TextRenderer tr = client.textRenderer;
	
	valueField =
		new TextFieldWidget(tr, x1, y1, 200, 20, new LiteralText(""));
	valueField.setText("");
	valueField.setSelectionStart(0);
	
	children.add(valueField);
	setInitialFocus(valueField);
	valueField.setSelected(true);
	
	doneButton = new ButtonWidget(x1, y2, 200, 20, new LiteralText("Done"),
		b -> done());
	addButton(doneButton);
}
 
Example 2
Source File: KeybindEditorScreen.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void init()
{
	addButton(new ButtonWidget(width / 2 - 100, 60, 200, 20,
		new LiteralText("Change Key"),
		b -> client.openScreen(new PressAKeyScreen(this))));
	
	addButton(new ButtonWidget(width / 2 - 100, height / 4 + 72, 200, 20,
		new LiteralText("Save"), b -> save()));
	
	addButton(new ButtonWidget(width / 2 - 100, height / 4 + 96, 200, 20,
		new LiteralText("Cancel"), b -> client.openScreen(prevScreen)));
	
	commandField = new TextFieldWidget(textRenderer, width / 2 - 100, 100,
		200, 20, new LiteralText(""));
	commandField.setMaxLength(65536);
	children.add(commandField);
	setInitialFocus(commandField);
	commandField.setSelected(true);
	
	if(oldCommands != null)
		commandField.setText(oldCommands);
}
 
Example 3
Source File: EditBlockScreen.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void init()
{
	int x1 = width / 2 - 100;
	int y1 = 60;
	int y2 = height / 3 * 2;
	
	TextRenderer tr = client.textRenderer;
	String valueString = setting.getBlockName();
	
	blockField =
		new TextFieldWidget(tr, x1, y1, 178, 18, new LiteralText(""));
	blockField.setText(valueString);
	blockField.setSelectionStart(0);
	
	children.add(blockField);
	setInitialFocus(blockField);
	blockField.setSelected(true);
	
	doneButton = new ButtonWidget(x1, y2, 200, 20, new LiteralText("Done"),
		b -> done());
	addButton(doneButton);
}
 
Example 4
Source File: EditSliderScreen.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void init()
{
	int x1 = width / 2 - 100;
	int y1 = 60;
	int y2 = height / 3 * 2;
	
	TextRenderer tr = client.textRenderer;
	ValueDisplay vd = ValueDisplay.DECIMAL;
	String valueString = vd.getValueString(slider.getValue());
	
	valueField =
		new TextFieldWidget(tr, x1, y1, 200, 20, new LiteralText(""));
	valueField.setText(valueString);
	valueField.setSelectionStart(0);
	
	children.add(valueField);
	setInitialFocus(valueField);
	valueField.setSelected(true);
	
	doneButton = new ButtonWidget(x1, y2, 200, 20, new LiteralText("Done"),
		b -> done());
	addButton(doneButton);
}
 
Example 5
Source File: NavigatorMainScreen.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onResize()
{
	TextRenderer tr = WurstClient.MC.textRenderer;
	searchBar =
		new TextFieldWidget(tr, 0, 32, 200, 20, new LiteralText(""));
	searchBar.setHasBorder(false);
	searchBar.setMaxLength(128);
	
	children.add(searchBar);
	setInitialFocus(searchBar);
	searchBar.setSelected(true);
	
	searchBar.x = middleX - 100;
	setContentHeight(navigatorDisplayList.size() / 3 * 20);
}
 
Example 6
Source File: ServerFinderScreen.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void init()
{
	addButton(searchButton =
		new ButtonWidget(width / 2 - 100, height / 4 + 96 + 12, 200, 20,
			new LiteralText("Search"), b -> searchOrCancel()));
	
	addButton(new ButtonWidget(width / 2 - 100, height / 4 + 120 + 12, 200,
		20, new LiteralText("Tutorial"),
		b -> Util.getOperatingSystem().open(
			"https://www.wurstclient.net/wiki/Special_Features/Server_Finder/")));
	
	addButton(new ButtonWidget(width / 2 - 100, height / 4 + 144 + 12, 200,
		20, new LiteralText("Back"), b -> client.openScreen(prevScreen)));
	
	ipBox = new TextFieldWidget(textRenderer, width / 2 - 100,
		height / 4 + 34, 200, 20, new LiteralText(""));
	ipBox.setMaxLength(200);
	ipBox.setSelected(true);
	children.add(ipBox);
	
	maxThreadsBox = new TextFieldWidget(textRenderer, width / 2 - 32,
		height / 4 + 58, 26, 12, new LiteralText(""));
	maxThreadsBox.setMaxLength(3);
	maxThreadsBox.setText("128");
	children.add(maxThreadsBox);
	
	setInitialFocus(ipBox);
	state = ServerFinderState.NOT_RUNNING;
	
	WurstClient.INSTANCE.getAnalytics()
		.trackPageView("/multiplayer/server-finder", "Server Finder");
}