Search code examples
javaswinglayoutlayout-managerspringlayout

Can SpringLayout do all the job


I would like to ask if SpringLayout can do anything like absolute position because I think absolute position have problem when I maximize the frame and what do I have to use if I need to set JMenu and JToolBar and JTextField and JTable all in one line in order?

I tried to use Borderlayout but it give me very big JTextField. I tried Gridlayout it give also big JTextField I need it big but not as big as it shows up.


Solution

  • can SpringLayout do all the job

    No. It is neither designed, nor intended to do 'all the job'.

    Java GUIs might have to work on a number of platforms, on different screen resolutions & using different PLAFs. As such they are not conducive to exact placement of components. To organize the components for a robust GUI, instead use layout managers, or combinations of them1, along with layout padding & borders for white space2.