+ 3
Problems with java swing
Hello! Iâm having two problems with my java swing code: 1. The dice image and the button arenât placed one under another. 2. The JPanel called âpanelDentroâ isnât placed at the center of the panel called âpanelBlancoâ. Can you help me? (You can use replit to see the output) I donât want ChatGPT answers, please. https://code.sololearn.com/cUg49824pH4y/?ref=app
5 RĂ©ponses
+ 2
I've just started reading about this. I didn't see it in your code, but have you heard about Grid Layout? That might help, or even LinearLayout.
Jayakrishna đźđł and AÍąJ are my "Java experts", they might have a better, more direct answer.
+ 1
I thought that I'd tagged them... đ€
I'll send them the link, see if they have time.
+ 1
Ausgrindtube thank you
+ 1
Hi, i would replace your panelDentro with a BorderLayout and add dado label to CENTER and button to SOUTH like this
panelDentro.add(dado,BorderLayout.CENTER);
panelDentro.add(tirar,BorderLayout.SOUTH);
And also give your panelBlanco a BorderLayout and then add your panelDentro to panelBlanco like this
panelBlanco.add(panelDentro,BorderLayout.CENTER);
0
Ausgrindtube should I ping them? I will search about that layouts. Thank you for your answer!