+ 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 ответов
+ 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!