How to position JComboBox properly? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How to position JComboBox properly?

I am creating a Jframe that has a JComboBox but the combo box is covering all the frame even after setting bounds correctly. Is there any way to solve it?

5th Aug 2020, 6:57 AM
Shah Fahad
Shah Fahad - avatar
4 Answers
+ 2
Im sure you forgot to add frame.setLayout(null);
6th Aug 2020, 10:55 PM
JavaBobbo
JavaBobbo - avatar
+ 1
Yes, you can use BorderLayout to your JFrame, then create 2 JPanels, add panel1 to BorderLayout.NORTH : frame.add(panel1, BorderLayout.NORTH); and panel2 to BorderLayout.CENTER: frame.add(panel2, BorderLayout.CENTER); then you can just add your buttons to panel1 (JPanel is using FlowLayout as default) Try it out yourself, if you still got some problems just tell me
7th Aug 2020, 4:18 AM
JavaBobbo
JavaBobbo - avatar
0
JavaBobbo Yes that was the problem. Thank you.
7th Aug 2020, 12:29 AM
Shah Fahad
Shah Fahad - avatar
0
How to create a offline gaming apps please sent me the post
3rd Feb 2021, 1:54 PM
Pavan Cm o66
Pavan Cm o66 - avatar