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

The following examples show how to use net.runelite.api.widgets.Widget#setSpriteId() . 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: BronzeManPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
private void addItemToCollectionLog(Widget collectionView, Integer itemId, int x, int y, int index)
{
	String itemName = itemManager.getItemDefinition(itemId).getName();
	Widget newItem = collectionView.createChild(index, 5);
	newItem.setContentType(0);
	newItem.setItemId(itemId);
	newItem.setItemQuantity(1);
	newItem.setItemQuantityMode(0);
	newItem.setModelId(-1);
	newItem.setModelType(1);
	newItem.setSpriteId(-1);
	newItem.setBorderType(1);
	newItem.setFilled(false);
	newItem.setRelativeX(x);
	newItem.setRelativeY(y);
	newItem.setOriginalX(x);
	newItem.setOriginalY(y);
	newItem.setOriginalWidth(36);
	newItem.setOriginalHeight(32);
	newItem.setWidth(36);
	newItem.setHeight(32);
	newItem.setHasListener(true);
	newItem.setAction(1, "Inspect");
	newItem.setOnOpListener((JavaScriptCallback) e -> handleItemAction(itemName));
	newItem.setName(itemName);
	newItem.revalidate();
}
 
Example 2
Source File: TabInterface.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
private Widget createGraphic(Widget container, String name, int spriteId, int itemId, int width, int height, int x, int y, boolean hasListener)
{
	Widget widget = container.createChild(-1, WidgetType.GRAPHIC);
	widget.setOriginalWidth(width);
	widget.setOriginalHeight(height);
	widget.setOriginalX(x);
	widget.setOriginalY(y);

	widget.setSpriteId(spriteId);

	if (itemId > -1)
	{
		widget.setItemId(itemId);
		widget.setItemQuantity(-1);
		widget.setBorderType(1);
	}

	if (hasListener)
	{
		widget.setOnOpListener(ScriptID.NULL);
		widget.setHasListener(true);
	}

	widget.setName(name);
	widget.revalidate();

	return widget;
}
 
Example 3
Source File: TabInterface.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
private void openTag(final String tag)
{
	activateTab(tabManager.find(tag));
	bankSearch.search(InputType.SEARCH, TAG_SEARCH + tag, true);

	// When tab is selected with search window open, the search window closes but the search button
	// stays highlighted, this solves that issue
	Widget searchBackground = client.getWidget(WidgetInfo.BANK_SEARCH_BUTTON_BACKGROUND);
	searchBackground.setSpriteId(SpriteID.EQUIPMENT_SLOT_TILE);
}
 
Example 4
Source File: ItemStatPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
private static void createSeparator(Widget parent, int y)
{
	Widget separator = parent.createChild(-1, WidgetType.GRAPHIC);
	separator.setOriginalWidth(parent.getWidth());
	separator.setOriginalY(y);
	separator.setOriginalHeight(32);
	separator.setSpriteId(SpriteID.UNKNOWN_BORDER_EDGE_HORIZONTAL_995);
	separator.revalidate();
}
 
Example 5
Source File: TabInterface.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private Widget createGraphic(Widget container, String name, int spriteId, int itemId, int width, int height, int x, int y, boolean hasListener)
{
	Widget widget = container.createChild(-1, WidgetType.GRAPHIC);
	widget.setOriginalWidth(width);
	widget.setOriginalHeight(height);
	widget.setOriginalX(x);
	widget.setOriginalY(y);

	widget.setSpriteId(spriteId);

	if (itemId > -1)
	{
		widget.setItemId(itemId);
		widget.setItemQuantity(-1);
		widget.setBorderType(1);
	}

	if (hasListener)
	{
		widget.setOnOpListener(ScriptID.NULL);
		widget.setHasListener(true);
	}

	widget.setName(name);
	widget.revalidate();

	return widget;
}
 
Example 6
Source File: TabInterface.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void openTag(final String tag)
{
	bankSearch.search(InputType.SEARCH, TAG_SEARCH + tag, true);
	activateTab(tabManager.find(tag));

	// When tab is selected with search window open, the search window closes but the search button
	// stays highlighted, this solves that issue
	Widget searchBackground = client.getWidget(WidgetInfo.BANK_SEARCH_BUTTON_BACKGROUND);
	searchBackground.setSpriteId(SpriteID.EQUIPMENT_SLOT_TILE);
}
 
Example 7
Source File: ItemStatPlugin.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private static void createSeparator(Widget parent, int y)
{
	Widget separator = parent.createChild(-1, WidgetType.GRAPHIC);
	separator.setOriginalWidth(parent.getWidth());
	separator.setOriginalY(y);
	separator.setOriginalHeight(32);
	separator.setSpriteId(SpriteID.UNKNOWN_BORDER_EDGE_HORIZONTAL_995);
	separator.revalidate();
}
 
Example 8
Source File: TabInterface.java    From plugins with GNU General Public License v3.0 4 votes vote down vote up
private void updateBounds()
{
	Widget itemContainer = client.getWidget(WidgetInfo.BANK_ITEM_CONTAINER);
	if (itemContainer == null)
	{
		return;
	}

	int height = itemContainer.getHeight();

	// If player isn't using normal bank tabs
	if (itemContainer.getRelativeY() == 0)
	{
		height -= (TAB_HEIGHT + MARGIN);
	}

	bounds.setSize(TAB_WIDTH + MARGIN * 2, height);
	bounds.setLocation(MARGIN, TAB_HEIGHT + MARGIN);

	Widget incinerator = client.getWidget(WidgetInfo.BANK_INCINERATOR);

	if (incinerator != null && !incinerator.isHidden())
	{
		incinerator.setOriginalHeight(INCINERATOR_HEIGHT);
		incinerator.setOriginalWidth(INCINERATOR_WIDTH);
		incinerator.setOriginalY(INCINERATOR_HEIGHT);

		Widget child = incinerator.getDynamicChildren()[0];
		child.setOriginalHeight(INCINERATOR_HEIGHT);
		child.setOriginalWidth(INCINERATOR_WIDTH);
		child.setWidthMode(WidgetSizeMode.ABSOLUTE);
		child.setHeightMode(WidgetSizeMode.ABSOLUTE);
		child.setType(WidgetType.GRAPHIC);
		child.setSpriteId(TabSprites.INCINERATOR.getSpriteId());
		incinerator.revalidate();

		bounds.setSize(TAB_WIDTH + MARGIN * 2, height - incinerator.getHeight());
	}

	if (upButton != null)
	{
		Point p = upButton.getCanvasLocation();
		canvasBounds.setBounds(p.getX(), p.getY() + BUTTON_HEIGHT, bounds.width, maxTabs * TAB_HEIGHT + maxTabs * MARGIN);
	}
}
 
Example 9
Source File: TabInterface.java    From runelite with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private void updateBounds()
{
	Widget itemContainer = client.getWidget(WidgetInfo.BANK_ITEM_CONTAINER);
	if (itemContainer == null)
	{
		return;
	}

	int height = itemContainer.getHeight();

	// If player isn't using normal bank tabs
	if (itemContainer.getRelativeY() == 0)
	{
		height -= (TAB_HEIGHT + MARGIN);
	}

	bounds.setSize(TAB_WIDTH + MARGIN * 2, height);
	bounds.setLocation(MARGIN, TAB_HEIGHT + MARGIN);

	Widget incinerator = client.getWidget(WidgetInfo.BANK_INCINERATOR);

	if (incinerator != null && !incinerator.isHidden())
	{
		incinerator.setOriginalHeight(INCINERATOR_HEIGHT);
		incinerator.setOriginalWidth(INCINERATOR_WIDTH);
		incinerator.setOriginalY(INCINERATOR_HEIGHT);

		Widget child = incinerator.getDynamicChildren()[0];
		child.setOriginalHeight(INCINERATOR_HEIGHT);
		child.setOriginalWidth(INCINERATOR_WIDTH);
		child.setWidthMode(WidgetSizeMode.ABSOLUTE);
		child.setHeightMode(WidgetSizeMode.ABSOLUTE);
		child.setType(WidgetType.GRAPHIC);
		child.setSpriteId(TabSprites.INCINERATOR.getSpriteId());
		incinerator.revalidate();

		bounds.setSize(TAB_WIDTH + MARGIN * 2, height - incinerator.getHeight());
	}

	if (upButton != null)
	{
		Point p = upButton.getCanvasLocation();
		canvasBounds.setBounds(p.getX(), p.getY() + BUTTON_HEIGHT, bounds.width, maxTabs * TAB_HEIGHT + maxTabs * MARGIN);
	}
}