Package org.dreambot.api.methods.widget
Class Widgets
- java.lang.Object
-
- org.dreambot.api.methods.widget.Widgets
-
public class Widgets extends java.lang.Object
API class revolving aroundWidget
andWidgetChild
It should be noted thatWidget
is essentially just a container ofWidgetChild
Logic in general should not be applied toWidget
and should instead be focused onWidgetChild
-
-
Constructor Summary
Constructors Constructor Description Widgets()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static boolean
closeAll()
This will attempt to close out of any interfaces that might be opened that are on the game screenstatic WidgetChild
get(int... ids)
GetsWidgetChild
based on the given ids Null checks each layerstatic WidgetChild
get(Filter<WidgetChild> filter)
Returns the first widget matching the filter, terminating as soon as one is found.static java.util.List<WidgetChild>
getAll(Filter<WidgetChild> filter)
Gets a List of widget children that match the filter providedstatic java.util.List<WidgetChild>
getAllContainingText(java.lang.String text)
Gets a list of theWidgetChild
containing a particular search string Try to avoid using this method if you can (ie.static java.util.List<Widget>
getAllWidgets()
Gets all theWidget
sstatic WidgetChild
getChildWidget(int parent, int child)
Deprecated.seeget(int...)
static WidgetChild
getMatchingWidget(Filter<WidgetChild> filter)
Deprecated.static WidgetChild
getSelected()
static WidgetChild
getSelectedWidget()
Deprecated.seegetSelected()
static int
getSelectedWidgetId()
Gets the currently selected widget ID (child ID) -1 if none selectedstatic int
getSelectedWidgetIndex()
Gets the currently selected widget index (grandchild ID) -1 if selected widget is not a grandchild or if none selectedstatic Widget
getWidget(int id)
Gets top level parentWidget
based on the idstatic WidgetChild
getWidgetChild(int... ids)
Deprecated.static java.util.List<WidgetChild>
getWidgetChildrenContainingText(java.lang.String text)
Deprecated.static java.util.List<WidgetChild>
getWidgets(Filter<WidgetChild> filter)
Deprecated.seegetAll(Filter)
static int[]
getWidgetXArray()
Gets the widget x arraystatic int[]
getWidgetYArray()
Gets the widget y arraystatic boolean
isOpen()
This checks if any non-default interfaces are open that block the game screen (even partially)static boolean
isVisible(int... ids)
Checks if aWidgetChild
is visiblestatic boolean
isWidgetSelected()
Checks to see if you have a widget selectedstatic void
setSelectedWidgetId(int id)
static void
setSelectedWidgetIndex(int index)
-
-
-
Method Detail
-
getAllWidgets
public static java.util.List<Widget> getAllWidgets()
Gets all theWidget
sThis method has a lot of overhead, so call it as little as possible.
- Returns:
- list of all parent Widgets
-
getWidget
public static Widget getWidget(int id)
Gets top level parentWidget
based on the id- Parameters:
id
- of the widget to find- Returns:
- the widget matching the id
-
getChildWidget
@Deprecated public static WidgetChild getChildWidget(int parent, int child)
Deprecated.seeget(int...)
-
get
public static WidgetChild get(int... ids)
GetsWidgetChild
based on the given ids Null checks each layer- Parameters:
ids
- ids to check, parent being first, child second, etc- Returns:
- Widget child matching the ids or null
-
getWidgetChild
@Deprecated public static WidgetChild getWidgetChild(int... ids)
Deprecated.seeget(int...)
-
isVisible
public static boolean isVisible(int... ids)
Checks if aWidgetChild
is visible- Parameters:
ids
- ids to check, parent being first, child second, etc seeget(int...)
- Returns:
- True if the widget is not null and visible, else false
-
getAllContainingText
public static java.util.List<WidgetChild> getAllContainingText(java.lang.String text)
Gets a list of theWidgetChild
containing a particular search string Try to avoid using this method if you can (ie. if you know the Widget parent ID, search manually) This method will search all children- Parameters:
text
- text to search for. Case sensitive- Returns:
- list of widget children with message containing search text
-
getWidgetChildrenContainingText
@Deprecated public static java.util.List<WidgetChild> getWidgetChildrenContainingText(java.lang.String text)
Deprecated.
-
get
public static WidgetChild get(Filter<WidgetChild> filter)
Returns the first widget matching the filter, terminating as soon as one is found. Useful for minimizing resource usage.- Parameters:
filter
- Filter to pass widget children through- Returns:
- The first widget child if found, otherwise null
-
getMatchingWidget
@Deprecated public static WidgetChild getMatchingWidget(Filter<WidgetChild> filter)
Deprecated.seeget(Filter)
-
getAll
public static java.util.List<WidgetChild> getAll(Filter<WidgetChild> filter)
Gets a List of widget children that match the filter provided- Parameters:
filter
- Filter to pass widget children through- Returns:
- List of Widget children that pass the filter provided
-
getWidgets
@Deprecated public static java.util.List<WidgetChild> getWidgets(Filter<WidgetChild> filter)
Deprecated.seegetAll(Filter)
-
isOpen
public static boolean isOpen()
This checks if any non-default interfaces are open that block the game screen (even partially)- Returns:
- true if at least one is found, false otherwise
-
closeAll
public static boolean closeAll()
This will attempt to close out of any interfaces that might be opened that are on the game screen- Returns:
- true if we can't find any open screen blocking interfaces after closing if necessary, false otherwise
-
getWidgetYArray
public static int[] getWidgetYArray()
Gets the widget y array- Returns:
- widget Y array
-
getWidgetXArray
public static int[] getWidgetXArray()
Gets the widget x array- Returns:
- widget X array
-
isWidgetSelected
public static boolean isWidgetSelected()
Checks to see if you have a widget selected
-
getSelectedWidgetId
public static int getSelectedWidgetId()
Gets the currently selected widget ID (child ID) -1 if none selected
-
setSelectedWidgetId
public static void setSelectedWidgetId(int id)
-
getSelectedWidgetIndex
public static int getSelectedWidgetIndex()
Gets the currently selected widget index (grandchild ID) -1 if selected widget is not a grandchild or if none selected
-
setSelectedWidgetIndex
public static void setSelectedWidgetIndex(int index)
-
getSelected
public static WidgetChild getSelected()
- Returns:
- The currently selected
WidgetChild
or null if none selected
-
getSelectedWidget
@Deprecated public static WidgetChild getSelectedWidget()
Deprecated.seegetSelected()
-
-