Hello I’d like to get this swing layout inside a JPanel:
JLabel – JTextField – JComboBox
as the panel resizes I’d like the textField to expand but not the other two. Everything must remain in line. I tried grid bag layout but doesn’t work… or I can’t. Ideas?
If you have three components and want the one in the middle to expand, you can for example use a BorderLayout, put your JLabel at BorderLayout.WEST, your JComboBox at BorderLayout.EAST and the one you want to expand (JTextField) at BorderLayout.CENTER.
The following is ugly, but the intent is to be minimal yet show the behavior you want: