Well you need to calculate the new size yourself, since you need more space if you draw the text beside the icon. And then in the paint method you simply call drawImage() and drawText().