Adding multiple components to 1 container index
Ok so i'm new to GUI's in java basically what i'm trying to accomplish:
I'm drawing a screen that has objects oriented to a grid, displaying numbers in JLabels and Graphics over the numbers.
for example, the issue i'm having currently is i have a container and i'm using setLayout(new GridLayout)
which gives me a grid. in 1 of the grids i have a JLabel displaying a number 85% and behind that number i want to draw a rectangle only 85% full. I have the JLabel displaying the number and I have the rectangle, but i do not know how to put them in the same square on the grid. I tried looking into LayeredPanes but i think i just didn't understand it, Does anyone have an idea on what would be the easiest way to do this? I'm not asking for someone to do the work, just simply what would be the best way to put 2 objects in the same grid square?
I add them by using contentPane.add(JLabel) i also tried giving both objects the same index but that didn't work. any help is greatly appreciated
this is what i'm trying to make it look like, black is background orange is the drawing and 100% is the JLabel