Java swing retrieving in tree format

I have Level1, Level2, Level3, Level4, Level5 tables with id, P_code, ItemNo, Drawing as column.

e.g. Level1 table same as for all table.

id|P_code|ItemNo|Drawing

I want to populate this with

Level|Level1 |Level2|Level3|
L1   |Item1  |      |      |
L2   |       |Item2 |      |
L3   |       |      |Item3 |
L2   |       |Item4 |      |
L3   |       |      |Item5 |

I am using MySQL DB. Is it possible?