Java Code Examples for net.runelite.api.widgets.Widget#setItemQuantity()
The following examples show how to use
net.runelite.api.widgets.Widget#setItemQuantity() .
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 |
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 |
private void addTabOptions(Widget w) { int clickmask = w.getClickMask(); clickmask |= WidgetConfig.DRAG; clickmask |= WidgetConfig.DRAG_ON; w.setClickMask(clickmask); w.setDragDeadTime(5); w.setDragDeadZone(5); w.setItemQuantity(10000); w.setItemQuantityMode(ItemQuantityMode.NEVER); }
Example 3
Source File: TabInterface.java From plugins with GNU General Public License v3.0 | 5 votes |
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 4
Source File: TabInterface.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
private void addTabOptions(Widget w) { int clickmask = w.getClickMask(); clickmask |= WidgetConfig.DRAG; clickmask |= WidgetConfig.DRAG_ON; w.setClickMask(clickmask); w.setDragDeadTime(5); w.setDragDeadZone(5); w.setItemQuantity(10000); w.setItemQuantityMode(ItemQuantityMode.NEVER); }
Example 5
Source File: TabInterface.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
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: ChatboxItemSearch.java From runelite with BSD 2-Clause "Simplified" License | 4 votes |
@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; } }