Java Code Examples for net.runelite.api.widgets.Widget#setTextColor()

The following examples show how to use net.runelite.api.widgets.Widget#setTextColor() . 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: FriendsChatPlugin.java    From plugins with GNU General Public License v3.0 6 votes vote down vote up
private void colorIgnoredPlayers(Color ignoreColor)
{
	Widget chatList = client.getWidget(WidgetInfo.FRIENDS_CHAT_LIST);
	if (chatList == null || chatList.getChildren() == null)
	{
		return;
	}

	NameableContainer<Ignore> ignoreContainer = client.getIgnoreContainer();
	// Iterate every 3 widgets, since the order of widgets is name, world, icon
	for (int i = 0; i < chatList.getChildren().length; i += 3)
	{
		Widget listWidget = chatList.getChild(i);
		String memberName = listWidget.getText();
		if (memberName.isEmpty() || ignoreContainer.findByName(memberName) == null)
		{
			continue;
		}

		listWidget.setTextColor(ignoreColor.getRGB());
	}
}
 
Example 2
Source File: ChatboxTextInput.java    From runelite with BSD 2-Clause "Simplified" License 6 votes vote down vote up
protected void update()
{
	Widget container = chatboxPanelManager.getContainerWidget();
	container.deleteAllChildren();

	Widget promptWidget = container.createChild(-1, WidgetType.TEXT);
	promptWidget.setText(this.prompt);
	promptWidget.setTextColor(0x800000);
	promptWidget.setFontId(fontID);
	promptWidget.setXPositionMode(WidgetPositionMode.ABSOLUTE_CENTER);
	promptWidget.setOriginalX(0);
	promptWidget.setYPositionMode(WidgetPositionMode.ABSOLUTE_TOP);
	promptWidget.setOriginalY(8);
	promptWidget.setOriginalHeight(24);
	promptWidget.setXTextAlignment(WidgetTextAlignment.CENTER);
	promptWidget.setYTextAlignment(WidgetTextAlignment.CENTER);
	promptWidget.setWidthMode(WidgetSizeMode.MINUS);
	promptWidget.revalidate();

	buildEdit(0, 50, container.getWidth(), 0);
}
 
Example 3
Source File: FriendsChatPlugin.java    From runelite with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void loadFriendsChats()
{
	Widget chatList = client.getWidget(WidgetInfo.FRIENDS_CHAT_LIST);
	if (chatList == null)
	{
		return;
	}

	int y = 2;
	chatList.setChildren(null);
	for (String chat : Lists.reverse(chats))
	{
		Widget widget = chatList.createChild(-1, WidgetType.TEXT);
		widget.setFontId(494);
		widget.setTextColor(0xffffff);
		widget.setText(chat);
		widget.setOriginalHeight(14);
		widget.setOriginalWidth(142);
		widget.setOriginalY(y);
		widget.setOriginalX(20);
		widget.revalidate();

		y += 14;
	}
}
 
Example 4
Source File: FriendsChatPlugin.java    From runelite with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void colorIgnoredPlayers(Color ignoreColor)
{
	Widget chatList = client.getWidget(WidgetInfo.FRIENDS_CHAT_LIST);
	if (chatList == null || chatList.getChildren() == null)
	{
		return;
	}

	NameableContainer<Ignore> ignoreContainer = client.getIgnoreContainer();
	// Iterate every 3 widgets, since the order of widgets is name, world, icon
	for (int i = 0; i < chatList.getChildren().length; i += 3)
	{
		Widget listWidget = chatList.getChild(i);
		String memberName = listWidget.getText();
		if (memberName.isEmpty() || ignoreContainer.findByName(memberName) == null)
		{
			continue;
		}

		listWidget.setTextColor(ignoreColor.getRGB());
	}
}
 
Example 5
Source File: BronzeManPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
private void filterResults()
{
	Widget grandExchangeWindow = client.getWidget(162, 53);
	if (grandExchangeWindow == null)
	{
		return;
	}
	if (client.getWidget(162, 53) == null)
	{
		return;
	}

	Widget[] children = client.getWidget(162, 53).getChildren();
	if (children == null)
	{
		return;
	}

	for (int i = 0; i < children.length; i += 3)
	{
		if (children[i] == null)
		{
			continue;
		}
		if (i + 2 > children.length - 1 || children[i + 2] == null)
		{
			continue;
		}

		if (!unlockedItems.contains(children[i + 2].getItemId()))
		{
			children[i].setHidden(true);
			Widget text = children[i + 1];
			Widget image = children[i + 2];
			text.setTextColor(textColor.getRGB());
			text.setOpacity(210);
			image.setOpacity(210);
		}
	}
}
 
Example 6
Source File: ItemStatPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
private static Widget createText(Widget parent, String text, int fontId, int textColor,
								int x, int y, int width, int height)
{
	final Widget widget = parent.createChild(-1, WidgetType.TEXT);
	widget.setText(text);
	widget.setFontId(fontId);
	widget.setTextColor(textColor);
	widget.setTextShadowed(true);
	widget.setOriginalHeight(height == -1 ? TEXT_HEIGHT : height);
	widget.setOriginalWidth(width);
	widget.setOriginalY(y);
	widget.setOriginalX(x);
	widget.revalidate();
	return widget;
}
 
Example 7
Source File: FriendsChatPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
private void loadFriendsChats()
{
	Widget chatList = client.getWidget(WidgetInfo.FRIENDS_CHAT_LIST);
	if (chatList == null)
	{
		return;
	}

	int y = 2;
	chatList.setChildren(null);
	for (String chat : Lists.reverse(chats))
	{
		Widget widget = chatList.createChild(-1, WidgetType.TEXT);
		widget.setFontId(494);
		widget.setHasListener(true);

		widget.setTextColor(0xffffff);
		widget.setText(chat);
		widget.setTextShadowed(true);
		widget.setBorderType(1);
		widget.setAction(0, String.format("Join %s", chat));
		widget.setOnOpListener(ScriptID.CUSTOM_JOIN_CLAN, widget.getText());
		widget.setOriginalHeight(14);
		widget.setOriginalWidth(142);
		widget.setOriginalY(y);
		widget.setOriginalX(20);
		widget.revalidate();

		y += 14;
	}
}
 
Example 8
Source File: ItemStatPlugin.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private static Widget createText(Widget parent, String text, int fontId, int textColor,
							int x, int y, int width, int height)
{
	final Widget widget = parent.createChild(-1, WidgetType.TEXT);
	widget.setText(text);
	widget.setFontId(fontId);
	widget.setTextColor(textColor);
	widget.setTextShadowed(true);
	widget.setOriginalHeight(height == -1 ? TEXT_HEIGHT : height);
	widget.setOriginalWidth(width);
	widget.setOriginalY(y);
	widget.setOriginalX(x);
	widget.revalidate();
	return widget;
}
 
Example 9
Source File: WikiSearchChatboxTextInput.java    From plugins with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void update()
{
	Widget container = chatboxPanelManager.getContainerWidget();
	container.deleteAllChildren();

	Widget promptWidget = container.createChild(-1, WidgetType.TEXT);
	promptWidget.setText(getPrompt());
	promptWidget.setTextColor(0x800000);
	promptWidget.setFontId(getFontID());
	promptWidget.setXPositionMode(WidgetPositionMode.ABSOLUTE_CENTER);
	promptWidget.setOriginalX(0);
	promptWidget.setYPositionMode(WidgetPositionMode.ABSOLUTE_TOP);
	promptWidget.setOriginalY(5);
	promptWidget.setOriginalHeight(LINE_HEIGHT);
	promptWidget.setXTextAlignment(WidgetTextAlignment.CENTER);
	promptWidget.setYTextAlignment(WidgetTextAlignment.CENTER);
	promptWidget.setWidthMode(WidgetSizeMode.MINUS);
	promptWidget.revalidate();

	buildEdit(0, 5 + LINE_HEIGHT, container.getWidth(), LINE_HEIGHT);

	Widget separator = container.createChild(-1, WidgetType.LINE);
	separator.setXPositionMode(WidgetPositionMode.ABSOLUTE_CENTER);
	separator.setOriginalX(0);
	separator.setYPositionMode(WidgetPositionMode.ABSOLUTE_TOP);
	separator.setOriginalY(4 + (LINE_HEIGHT * 2));
	separator.setOriginalHeight(0);
	separator.setOriginalWidth(16);
	separator.setWidthMode(WidgetSizeMode.MINUS);
	separator.revalidate();

	for (int i = 0; i < predictions.size(); i++)
	{
		String pred = predictions.get(i);
		int y = 6 + (LINE_HEIGHT * (2 + i));

		Widget bg = container.createChild(-1, WidgetType.RECTANGLE);
		bg.setTextColor(0x4444DD);
		bg.setFilled(true);
		bg.setXPositionMode(WidgetPositionMode.ABSOLUTE_CENTER);
		bg.setOriginalX(1);
		bg.setYPositionMode(WidgetPositionMode.ABSOLUTE_TOP);
		bg.setOriginalY(y);
		bg.setOriginalHeight(LINE_HEIGHT);
		bg.setOriginalWidth(16);
		bg.setWidthMode(WidgetSizeMode.MINUS);
		bg.revalidate();
		bg.setName("<col=ff9040>" + pred);
		bg.setAction(0, "Open");
		bg.setHasListener(true);
		bg.setOnOpListener((JavaScriptCallback) ev -> search(pred));

		Widget text = container.createChild(-1, WidgetType.TEXT);
		text.setText(pred);
		text.setFontId(getFontID());
		text.setXPositionMode(WidgetPositionMode.ABSOLUTE_CENTER);
		text.setOriginalX(0);
		text.setYPositionMode(WidgetPositionMode.ABSOLUTE_TOP);
		text.setOriginalY(y);
		text.setOriginalHeight(LINE_HEIGHT);
		text.setXTextAlignment(WidgetTextAlignment.CENTER);
		text.setYTextAlignment(WidgetTextAlignment.CENTER);
		text.setWidthMode(WidgetSizeMode.MINUS);
		text.revalidate();

		if (i == selectedPrediction)
		{
			text.setTextColor(0xFFFFFF);
		}
		else
		{
			bg.setOpacity(255);
			text.setTextColor(0x000000);
			bg.setOnMouseRepeatListener((JavaScriptCallback) ev -> text.setTextColor(0xFFFFFF));
			bg.setOnMouseLeaveListener((JavaScriptCallback) ev -> text.setTextColor(0x000000));
		}
	}
}
 
Example 10
Source File: XpDropPlugin.java    From plugins with GNU General Public License v3.0 4 votes vote down vote up
private void resetTextColor(Widget widget)
{
	int defaultColorIdx = client.getVar(Varbits.EXPERIENCE_DROP_COLOR);
	int defaultColor = DefaultColors.values()[defaultColorIdx].getColor().getRGB();
	widget.setTextColor(defaultColor);
}
 
Example 11
Source File: VirtualLevelsInterfaceInput.java    From plugins with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void open()
{
	// TODO: add sound event for level-up (need to find sound IDs)
	plugin.getClientThread().invoke(this::setFireworksGraphic);

	final Widget chatboxContainer = plugin.getChatboxPanelManager().getContainerWidget();

	final String skillName = skill.getName();
	final int skillLevel = Experience.getLevelForXp(plugin.getClient().getSkillExperience(skill));
	final List<SkillModel> skillModels = SkillModel.getSKILL_MODELS(skill);
	final String prefix = (skill == Skill.AGILITY || skill == Skill.ATTACK) ? "an " : "a ";

	final Widget levelUpLevel = chatboxContainer.createChild(-1, WidgetType.TEXT);
	final Widget levelUpText = chatboxContainer.createChild(-1, WidgetType.TEXT);
	final Widget levelUpContinue = chatboxContainer.createChild(-1, WidgetType.TEXT);

	levelUpLevel.setText("Congratulations, you just advanced " + prefix + skillName + " level.");
	levelUpLevel.setTextColor(Color.BLACK.getRGB());
	levelUpLevel.setFontId(FontID.QUILL_8);
	levelUpLevel.setXPositionMode(WidgetPositionMode.ABSOLUTE_TOP);
	levelUpLevel.setOriginalX(73 + X_OFFSET);
	levelUpLevel.setYPositionMode(WidgetPositionMode.ABSOLUTE_TOP);
	levelUpLevel.setOriginalY(15 + Y_OFFSET);
	levelUpLevel.setOriginalWidth(390);
	levelUpLevel.setOriginalHeight(30);
	levelUpLevel.setXTextAlignment(WidgetTextAlignment.CENTER);
	levelUpLevel.setYTextAlignment(WidgetTextAlignment.LEFT);
	levelUpLevel.setWidthMode(WidgetSizeMode.ABSOLUTE);
	levelUpLevel.revalidate();

	levelUpText.setText((skill == Skill.HITPOINTS
		? "Your Hitpoints are now " + skillLevel
		: "Your " + skillName + " level is now " + skillLevel) + '.');
	levelUpText.setFontId(FontID.QUILL_8);
	levelUpText.setXPositionMode(WidgetPositionMode.ABSOLUTE_TOP);
	levelUpText.setOriginalX(73 + X_OFFSET);
	levelUpText.setYPositionMode(WidgetPositionMode.ABSOLUTE_TOP);
	levelUpText.setOriginalY(44 + Y_OFFSET);
	levelUpText.setOriginalWidth(390);
	levelUpText.setOriginalHeight(30);
	levelUpText.setXTextAlignment(WidgetTextAlignment.CENTER);
	levelUpText.setYTextAlignment(WidgetTextAlignment.LEFT);
	levelUpText.setWidthMode(WidgetSizeMode.ABSOLUTE);
	levelUpText.revalidate();

	levelUpContinue.setText("Click here to continue");
	levelUpContinue.setTextColor(Color.BLUE.getRGB());
	levelUpContinue.setFontId(FontID.QUILL_8);
	levelUpContinue.setXPositionMode(WidgetPositionMode.ABSOLUTE_TOP);
	levelUpContinue.setOriginalX(73 + X_OFFSET);
	levelUpContinue.setYPositionMode(WidgetPositionMode.ABSOLUTE_TOP);
	levelUpContinue.setOriginalY(74 + Y_OFFSET);
	levelUpContinue.setOriginalWidth(390);
	levelUpContinue.setOriginalHeight(17);
	levelUpContinue.setXTextAlignment(WidgetTextAlignment.CENTER);
	levelUpContinue.setYTextAlignment(WidgetTextAlignment.LEFT);
	levelUpContinue.setWidthMode(WidgetSizeMode.ABSOLUTE);
	levelUpContinue.setAction(0, "Continue");
	levelUpContinue.setOnOpListener((JavaScriptCallback) ev -> triggerCloseViaMessage());
	levelUpContinue.setOnMouseOverListener((JavaScriptCallback) ev -> levelUpContinue.setTextColor(Color.WHITE.getRGB()));
	levelUpContinue.setOnMouseLeaveListener((JavaScriptCallback) ev -> levelUpContinue.setTextColor(Color.BLUE.getRGB()));
	levelUpContinue.setHasListener(true);
	levelUpContinue.revalidate();

	for (SkillModel skillModel : skillModels)
	{
		buildWidgetModel(chatboxContainer, skillModel);
	}

	plugin.takeScreenshot(skill);
}
 
Example 12
Source File: ChatboxTextMenuInput.java    From runelite with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
protected void open()
{
	Widget container = chatboxPanelManager.getContainerWidget();

	Widget prompt = container.createChild(-1, WidgetType.TEXT);
	prompt.setText(title);
	prompt.setTextColor(0x800000);
	prompt.setFontId(FontID.QUILL_8);
	prompt.setXPositionMode(WidgetPositionMode.ABSOLUTE_CENTER);
	prompt.setOriginalX(0);
	prompt.setYPositionMode(WidgetPositionMode.ABSOLUTE_TOP);
	prompt.setOriginalY(8);
	prompt.setOriginalHeight(24);
	prompt.setXTextAlignment(WidgetTextAlignment.CENTER);
	prompt.setYTextAlignment(WidgetTextAlignment.CENTER);
	prompt.setWidthMode(WidgetSizeMode.MINUS);
	prompt.revalidate();

	int y = prompt.getRelativeX() + prompt.getHeight() + 6;
	int height = container.getHeight() - y - 8;
	int step = height / options.size();
	int maxStep = options.size() >= 3 ? 25 : 30;
	if (step > maxStep)
	{
		int ds = step - maxStep;
		step = maxStep;
		y += (ds * options.size()) / 2;
	}

	for (Entry option : options)
	{
		Widget optWidget = container.createChild(-1, WidgetType.TEXT);
		optWidget.setText(option.text);
		optWidget.setFontId(FontID.QUILL_8);
		optWidget.setXPositionMode(WidgetPositionMode.ABSOLUTE_CENTER);
		optWidget.setOriginalX(0);
		optWidget.setYPositionMode(WidgetPositionMode.ABSOLUTE_TOP);
		optWidget.setOriginalY(y);
		optWidget.setOriginalHeight(24);
		optWidget.setXTextAlignment(WidgetTextAlignment.CENTER);
		optWidget.setYTextAlignment(WidgetTextAlignment.CENTER);
		optWidget.setWidthMode(WidgetSizeMode.MINUS);
		optWidget.setAction(0, "Continue");
		optWidget.setOnOpListener((JavaScriptCallback) ev -> callback(option));
		optWidget.setOnMouseOverListener((JavaScriptCallback) ev -> optWidget.setTextColor(0xFFFFFF));
		optWidget.setOnMouseLeaveListener((JavaScriptCallback) ev -> optWidget.setTextColor(0));
		optWidget.setHasListener(true);
		optWidget.revalidate();

		y += step;
	}
}
 
Example 13
Source File: ChatboxItemSearch.java    From runelite with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
protected void update()
{
	Widget container = chatboxPanelManager.getContainerWidget();
	container.deleteAllChildren();

	Widget promptWidget = container.createChild(-1, WidgetType.TEXT);
	promptWidget.setText(getPrompt());
	promptWidget.setTextColor(0x800000);
	promptWidget.setFontId(getFontID());
	promptWidget.setOriginalX(0);
	promptWidget.setOriginalY(5);
	promptWidget.setXPositionMode(WidgetPositionMode.ABSOLUTE_CENTER);
	promptWidget.setYPositionMode(WidgetPositionMode.ABSOLUTE_TOP);
	promptWidget.setOriginalHeight(FONT_SIZE);
	promptWidget.setXTextAlignment(WidgetTextAlignment.CENTER);
	promptWidget.setYTextAlignment(WidgetTextAlignment.CENTER);
	promptWidget.setWidthMode(WidgetSizeMode.MINUS);
	promptWidget.revalidate();

	buildEdit(0, 5 + FONT_SIZE, container.getWidth(), FONT_SIZE);

	Widget separator = container.createChild(-1, WidgetType.LINE);
	separator.setOriginalX(0);
	separator.setOriginalY(8 + (FONT_SIZE * 2));
	separator.setXPositionMode(WidgetPositionMode.ABSOLUTE_CENTER);
	separator.setYPositionMode(WidgetPositionMode.ABSOLUTE_TOP);
	separator.setOriginalHeight(0);
	separator.setOriginalWidth(16);
	separator.setWidthMode(WidgetSizeMode.MINUS);
	separator.setTextColor(0x666666);
	separator.revalidate();

	int x = PADDING;
	int y = PADDING * 3;
	int idx = 0;
	for (ItemComposition itemComposition : results.values())
	{
		Widget item = container.createChild(-1, WidgetType.GRAPHIC);
		item.setXPositionMode(WidgetPositionMode.ABSOLUTE_LEFT);
		item.setYPositionMode(WidgetPositionMode.ABSOLUTE_TOP);
		item.setOriginalX(x);
		item.setOriginalY(y + FONT_SIZE * 2);
		item.setOriginalHeight(ICON_HEIGHT);
		item.setOriginalWidth(ICON_WIDTH);
		item.setName("<col=ff9040>" + itemComposition.getName());
		item.setItemId(itemComposition.getId());
		item.setItemQuantity(10000);
		item.setItemQuantityMode(ItemQuantityMode.NEVER);
		item.setBorderType(1);
		item.setAction(0, tooltipText);
		item.setHasListener(true);

		if (index == idx)
		{
			item.setOpacity(HOVERED_OPACITY);
		}
		else
		{
			item.setOnMouseOverListener((JavaScriptCallback) ev -> item.setOpacity(HOVERED_OPACITY));
			item.setOnMouseLeaveListener((JavaScriptCallback) ev -> item.setOpacity(0));
		}

		item.setOnOpListener((JavaScriptCallback) ev ->
		{
			if (onItemSelected != null)
			{
				onItemSelected.accept(itemComposition.getId());
			}

			chatboxPanelManager.close();
		});

		x += ICON_WIDTH + PADDING;
		if (x + ICON_WIDTH >= container.getWidth())
		{
			y += ICON_HEIGHT + PADDING;
			x = PADDING;
		}

		item.revalidate();
		++idx;
	}
}
 
Example 14
Source File: WikiSearchChatboxTextInput.java    From runelite with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
protected void update()
{
	Widget container = chatboxPanelManager.getContainerWidget();
	container.deleteAllChildren();

	Widget promptWidget = container.createChild(-1, WidgetType.TEXT);
	promptWidget.setText(getPrompt());
	promptWidget.setTextColor(0x800000);
	promptWidget.setFontId(getFontID());
	promptWidget.setXPositionMode(WidgetPositionMode.ABSOLUTE_CENTER);
	promptWidget.setOriginalX(0);
	promptWidget.setYPositionMode(WidgetPositionMode.ABSOLUTE_TOP);
	promptWidget.setOriginalY(5);
	promptWidget.setOriginalHeight(LINE_HEIGHT);
	promptWidget.setXTextAlignment(WidgetTextAlignment.CENTER);
	promptWidget.setYTextAlignment(WidgetTextAlignment.CENTER);
	promptWidget.setWidthMode(WidgetSizeMode.MINUS);
	promptWidget.revalidate();

	buildEdit(0, 5 + LINE_HEIGHT, container.getWidth(), LINE_HEIGHT);

	Widget separator = container.createChild(-1, WidgetType.LINE);
	separator.setXPositionMode(WidgetPositionMode.ABSOLUTE_CENTER);
	separator.setOriginalX(0);
	separator.setYPositionMode(WidgetPositionMode.ABSOLUTE_TOP);
	separator.setOriginalY(4 + (LINE_HEIGHT * 2));
	separator.setOriginalHeight(0);
	separator.setOriginalWidth(16);
	separator.setWidthMode(WidgetSizeMode.MINUS);
	separator.revalidate();

	for (int i = 0; i < predictions.size(); i++)
	{
		String pred = predictions.get(i);
		int y = 6 + (LINE_HEIGHT * (2 + i));

		Widget bg = container.createChild(-1, WidgetType.RECTANGLE);
		bg.setTextColor(0x4444DD);
		bg.setFilled(true);
		bg.setXPositionMode(WidgetPositionMode.ABSOLUTE_CENTER);
		bg.setOriginalX(1);
		bg.setYPositionMode(WidgetPositionMode.ABSOLUTE_TOP);
		bg.setOriginalY(y);
		bg.setOriginalHeight(LINE_HEIGHT);
		bg.setOriginalWidth(16);
		bg.setWidthMode(WidgetSizeMode.MINUS);
		bg.revalidate();
		bg.setName("<col=ff9040>" + pred);
		bg.setAction(0, "Open");
		bg.setHasListener(true);
		bg.setOnOpListener((JavaScriptCallback) ev -> search(pred));

		Widget text = container.createChild(-1, WidgetType.TEXT);
		text.setText(pred);
		text.setFontId(getFontID());
		text.setXPositionMode(WidgetPositionMode.ABSOLUTE_CENTER);
		text.setOriginalX(0);
		text.setYPositionMode(WidgetPositionMode.ABSOLUTE_TOP);
		text.setOriginalY(y);
		text.setOriginalHeight(LINE_HEIGHT);
		text.setXTextAlignment(WidgetTextAlignment.CENTER);
		text.setYTextAlignment(WidgetTextAlignment.CENTER);
		text.setWidthMode(WidgetSizeMode.MINUS);
		text.revalidate();

		if (i == selectedPrediction)
		{
			text.setTextColor(0xFFFFFF);
		}
		else
		{
			bg.setOpacity(255);
			text.setTextColor(0x000000);
			bg.setOnMouseRepeatListener((JavaScriptCallback) ev -> text.setTextColor(0xFFFFFF));
			bg.setOnMouseLeaveListener((JavaScriptCallback) ev -> text.setTextColor(0x000000));
		}
	}
}
 
Example 15
Source File: XpDropPlugin.java    From runelite with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private void resetTextColor(Widget widget)
{
	int defaultColorIdx = client.getVar(Varbits.EXPERIENCE_DROP_COLOR);
	int defaultColor = DefaultColors.values()[defaultColorIdx].getColor().getRGB();
	widget.setTextColor(defaultColor);
}