JComboBox width

后端 未结 5 966
南旧
南旧 2020-12-15 08:31

I have created a jComboBox but it takes the full width of the frame. how to set the width fixed.

yes borderlayout for the frame and box layout for the panel. i am

5条回答
  •  爱一瞬间的悲伤
    2020-12-15 08:51

    try comboBox.setPreferredWidth(200); or some other value to set the width

    jzd is right. The actual API is setPreferredSize(new Dimension(...));

提交回复
热议问题