final Item[] items = client.getInventory().getItems();
if (items != null) {
for (int i = 0; i < items.length; i++) {
if (items[i] != null) {
final Rectangle r = client.getInventory().getDestinationForSlot(i);
g.drawString(Integer.toString(items[i].getId()), r.x - 5, r.y + 4);
}
}
There ya go. ;)