Java Code Examples for net.runelite.api.widgets.Widget#getChildren()
The following examples show how to use
net.runelite.api.widgets.Widget#getChildren() .
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: WikiPlugin.java From plugins with GNU General Public License v3.0 | 6 votes |
private void removeWidgets() { Widget minimapOrbs = client.getWidget(WidgetInfo.MINIMAP_ORBS); if (minimapOrbs == null) { return; } Widget[] children = minimapOrbs.getChildren(); if (children == null || children.length < 1) { return; } children[0] = null; Widget vanilla = client.getWidget(WidgetInfo.MINIMAP_WIKI_BANNER); if (vanilla != null) { vanilla.setHidden(false); } onDeselect(); client.setSpellSelected(false); }
Example 2
Source File: WidgetInspector.java From plugins with GNU General Public License v3.0 | 6 votes |
private void removePickerWidget() { if (picker == null) { return; } Widget parent = picker.getParent(); if (parent == null) { return; } Widget[] children = parent.getChildren(); if (children == null || children.length <= picker.getIndex() || children[picker.getIndex()] != picker) { return; } children[picker.getIndex()] = null; }
Example 3
Source File: FriendsChatPlugin.java From plugins with GNU General Public License v3.0 | 6 votes |
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 4
Source File: WikiPlugin.java From runelite with BSD 2-Clause "Simplified" License | 6 votes |
private void removeWidgets() { Widget minimapOrbs = client.getWidget(WidgetInfo.MINIMAP_ORBS); if (minimapOrbs == null) { return; } Widget[] children = minimapOrbs.getChildren(); if (children == null || children.length < 1) { return; } children[0] = null; Widget vanilla = client.getWidget(WidgetInfo.MINIMAP_WIKI_BANNER); if (vanilla != null) { vanilla.setHidden(false); } onDeselect(); client.setSpellSelected(false); }
Example 5
Source File: WidgetInspector.java From runelite with BSD 2-Clause "Simplified" License | 6 votes |
private void removePickerWidget() { if (picker == null) { return; } Widget parent = picker.getParent(); if (parent == null) { return; } Widget[] children = parent.getChildren(); if (children == null || children.length <= picker.getIndex() || children[picker.getIndex()] != picker) { return; } children[picker.getIndex()] = null; }
Example 6
Source File: FriendsChatPlugin.java From runelite with BSD 2-Clause "Simplified" License | 6 votes |
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 7
Source File: FriendsChatPlugin.java From plugins with GNU General Public License v3.0 | 5 votes |
@Subscribe private void onGameTick(GameTick gameTick) { if (client.getGameState() != GameState.LOGGED_IN) { return; } client.setVar(VarClientStr.RECENT_FRIENDS_CHAT, config.friendschatName()); Widget chatTitleWidget = client.getWidget(WidgetInfo.FRIENDS_CHAT_TITLE); if (chatTitleWidget != null) { Widget chatList = client.getWidget(WidgetInfo.FRIENDS_CHAT_LIST); Widget owner = client.getWidget(WidgetInfo.FRIENDS_CHAT_OWNER); FriendsChatManager friendsChatManager = client.getFriendsChatManager(); if (friendsChatManager != null && friendsChatManager.getCount() > 0) { chatTitleWidget.setText(TITLE + " (" + friendsChatManager.getCount() + "/100)"); } else if (config.recentChats() && chatList.getChildren() == null && !Strings.isNullOrEmpty(owner.getText())) { chatTitleWidget.setText(RECENT_TITLE); loadFriendsChats(); } } if (!config.showJoinLeave()) { return; } timeoutMessages(); addActivityMessages(); }
Example 8
Source File: FriendsChatPlugin.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
@Subscribe public void onGameTick(GameTick gameTick) { if (client.getGameState() != GameState.LOGGED_IN) { return; } Widget chatTitleWidget = client.getWidget(WidgetInfo.FRIENDS_CHAT_TITLE); if (chatTitleWidget != null) { Widget chatList = client.getWidget(WidgetInfo.FRIENDS_CHAT_LIST); Widget owner = client.getWidget(WidgetInfo.FRIENDS_CHAT_OWNER); FriendsChatManager friendsChatManager = client.getFriendsChatManager(); if (friendsChatManager != null && friendsChatManager.getCount() > 0) { chatTitleWidget.setText(TITLE + " (" + friendsChatManager.getCount() + "/100)"); } else if (config.recentChats() && chatList.getChildren() == null && !Strings.isNullOrEmpty(owner.getText())) { chatTitleWidget.setText(RECENT_TITLE); loadFriendsChats(); } } if (!config.showJoinLeave()) { return; } timeoutMessages(); addActivityMessages(); }
Example 9
Source File: MusicPlugin.java From plugins with GNU General Public License v3.0 | 4 votes |
private void teardownMusicOptions() { for (MusicSlider slider : MusicSlider.values()) { Widget icon = client.getWidget(slider.getWidgetID()); // VolumeChanged can trigger us before the sliders interface is fully valid, so // we check if the width is set before we copy it to all of our widgets if (icon == null || icon.getWidth() == 0) { return; } if (slider.getHandle() != null) { { Widget handle = slider.getHandle(); Widget parent = handle.getParent(); if (parent == null) { continue; } else { Widget[] siblings = parent.getChildren(); if (siblings == null || handle.getIndex() >= siblings.length || siblings[handle.getIndex()] != handle) { continue; } siblings[slider.getTrack().getIndex()] = null; siblings[handle.getIndex()] = null; } } Object[] init = icon.getOnLoadListener(); init[1] = slider.getWidgetID().getId(); // Readd the var transmit triggers and rerun options_allsounds client.runScript(init); slider.setHandle(null); slider.setTrack(null); } } }
Example 10
Source File: MusicPlugin.java From runelite with BSD 2-Clause "Simplified" License | 4 votes |
private void teardownMusicOptions() { for (MusicSlider slider : MusicSlider.values()) { Widget icon = client.getWidget(slider.getWidgetID()); if (icon == null) { return; } if (slider.getHandle() != null) { { Widget handle = slider.getHandle(); Widget parent = handle.getParent(); if (parent == null) { continue; } else { Widget[] siblings = parent.getChildren(); if (siblings == null || handle.getIndex() >= siblings.length || siblings[handle.getIndex()] != handle) { continue; } siblings[slider.getTrack().getIndex()] = null; siblings[handle.getIndex()] = null; } } Object[] init = icon.getOnLoadListener(); init[1] = slider.getWidgetID().getId(); // Readd the var transmit triggers and rerun options_allsounds client.runScript(init); slider.setHandle(null); slider.setTrack(null); } } }