public static void drawInventoryItem(final Graphics2D g, final int id) {
final Item[] items = client.getInventory().getItems();
for (int i = 0; i < items.length; i++) {
if (items[i] != null && items[i].getId() == id) {
final Rectangle r = client.getInventory().getDestinationForSlot(i);
g.drawRect(r.x, r.y, r.width, r.height);
}
}
}
Looks good. This is what I like to use.
Of course, you can always change it to fit your needs/preferences.