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
Here is something you can do with box layout.
. code snippet below:
panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.LINE_AXIS));
panel.add(Box.createHorizontalGlue());
panel.add(Box.createRigidArea(new Dimension(10, 0)));
panel.add(combo);
frame.getContentPane().add(BorderLayout.NORTH, panel);