Problems with java swing | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 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

9th Aug 2023, 3:54 PM
Ugulberto SƔnchez
Ugulberto SƔnchez - avatar
5 Respostas
+ 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.
10th Aug 2023, 7:00 AM
Ausgrindtube
Ausgrindtube - avatar
+ 1
I thought that I'd tagged them... šŸ¤” I'll send them the link, see if they have time.
10th Aug 2023, 11:36 AM
Ausgrindtube
Ausgrindtube - avatar
+ 1
Ausgrindtube thank you
10th Aug 2023, 11:40 AM
Ugulberto SƔnchez
Ugulberto SƔnchez - avatar
+ 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);
15th Aug 2023, 6:14 PM
JavaBobbo
JavaBobbo - avatar
0
Ausgrindtube should I ping them? I will search about that layouts. Thank you for your answer!
10th Aug 2023, 8:47 AM
Ugulberto SƔnchez
Ugulberto SƔnchez - avatar