Sorting JPanels in Grid Layout?

i am making a chatting software in which to friend list is displayed in a JPanel having Grid Layout . such that each Grid contain a panel for each friend. i want that the panels get sorted alphabetically (whenever i enter a new friend). so is it possible to do this.