I have my JTextField,a few JButtons inside javax.swing.Box.
Later in code I add JButtons into Box toolbarBox:
As you saw toolbarBox contains JTextField and horizontalGlue and later added JButtons.
The problem is that all available free space is occupied by JTextField but I want it to have fixed width and Box.createHorizontalGlue() should take all rest space. All JButtons have fixed width but JTextField stretches to take up all rest space in my horizontal Box?
How to make JTextField to be of fixed size and Box.createHorizontalGlue() take all rest space?
I posted already all relevant code!
ObjectsListPanel contains field private JTextField searchField;
This searchField is added into private Box toolbarBox as the rightmost element at line 13. Next horizontal glue is added at line 14. Next JButtons are added which is hapenning later dynamically.
Box toolbarBox is long and JButtons do not accupy all available space of toolbarBox. The problem is that searchField stretches itself to take up all available width but I want searchField to be of fixed width. Now width of searchField depends on width of toolbarBox and amount of JButtons in it.
How to make JTextField to be of fixed width in Box toolbarBox?
When you have a problem you don't know what code is or isn't relevant until the problem is solved.
That is why you post a SSCCE which is the minimal amount of code that demonstrates the problem when we execute the code.
If you would have posted a SSCCE with your question you probably would have had your answer by know. Who know the next time I will be at the forum so you likely need to wait hours again after you finally post your code.