JFrame layout for fixed position
Which layout is suitable for p开发者_运维技巧ositioning components on a JFrame and making them stay where they have been placed? I don't want controls to move around on resizing.
I suggest that you don't use null layout and that you don't fix your components in absolute position, not unless you want to have very ugly GUI's that are difficult or impossible to use in various operating systems and screen resolutions. Much better is to not even set any sizes but rather to nest layout managers and let the managers set preferred and appropriate sizes by calling pack on your top-level window (the JFrame) after adding all components.
Use a null LayoutManager explained here
精彩评论