Java Code Examples for net.runelite.api.widgets.Widget#setRelativeY()
The following examples show how to use
net.runelite.api.widgets.Widget#setRelativeY() .
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: WidgetOverlay.java From runelite with BSD 2-Clause "Simplified" License | 6 votes |
@Override public Dimension render(Graphics2D graphics) { final Widget widget = client.getWidget(widgetInfo); final Rectangle bounds = super.getBounds(); final Rectangle parent = getParentBounds(widget); if (parent.isEmpty()) { return null; } int x = bounds.x; int y = bounds.y; x = Math.max(parent.x, x); y = Math.max(parent.y, y); x = Math.min((int)parent.getMaxX() - bounds.width, x); y = Math.min((int)parent.getMaxY() - bounds.height, y); bounds.setLocation(x, y); widget.setOriginalX(0); widget.setOriginalY(0); widget.setRelativeX(bounds.x - parent.x); widget.setRelativeY(bounds.y - parent.y); return new Dimension(widget.getWidth(), widget.getHeight()); }
Example 2
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 3
Source File: InterfaceStylesPlugin.java From plugins with GNU General Public License v3.0 | 5 votes |
private void adjustWidgetDimensions() { for (WidgetOffset widgetOffset : WidgetOffset.values()) { if (widgetOffset.getSkin() != config.skin()) { continue; } Widget widget = client.getWidget(widgetOffset.getWidgetInfo()); if (widget != null) { if (widgetOffset.getOffsetX() != null) { widget.setRelativeX(widgetOffset.getOffsetX()); } if (widgetOffset.getOffsetY() != null) { widget.setRelativeY(widgetOffset.getOffsetY()); } if (widgetOffset.getWidth() != null) { widget.setWidth(widgetOffset.getWidth()); } if (widgetOffset.getHeight() != null) { widget.setHeight(widgetOffset.getHeight()); } } } }
Example 4
Source File: ChatboxPerformancePlugin.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
private void fixDarkBackground() { int currOpacity = 256; int prevY = 0; Widget[] children = client.getWidget(WidgetInfo.CHATBOX_TRANSPARENT_BACKGROUND).getDynamicChildren(); Widget prev = null; for (Widget w : children) { if (w.getType() != WidgetType.RECTANGLE) { continue; } if (prev != null) { int relY = w.getRelativeY(); prev.setHeightMode(WidgetSizeMode.ABSOLUTE); prev.setYPositionMode(WidgetPositionMode.ABSOLUTE_TOP); prev.setRelativeY(prevY); prev.setOriginalY(prev.getRelativeY()); prev.setHeight(relY - prevY); prev.setOriginalHeight(prev.getHeight()); prev.setOpacity(currOpacity); } prevY = w.getRelativeY(); currOpacity -= 3; // Rough number, can't get exactly the same as Jagex because of rounding prev = w; } if (prev != null) { prev.setOpacity(currOpacity); } }
Example 5
Source File: InterfaceStylesPlugin.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
private void adjustWidgetDimensions() { for (WidgetOffset widgetOffset : WidgetOffset.values()) { if (widgetOffset.getSkin() != config.skin()) { continue; } Widget widget = client.getWidget(widgetOffset.getWidgetInfo()); if (widget != null) { if (widgetOffset.getOffsetX() != null) { widget.setRelativeX(widgetOffset.getOffsetX()); } if (widgetOffset.getOffsetY() != null) { widget.setRelativeY(widgetOffset.getOffsetY()); } if (widgetOffset.getWidth() != null) { widget.setWidth(widgetOffset.getWidth()); } if (widgetOffset.getHeight() != null) { widget.setHeight(widgetOffset.getHeight()); } } } }