XY Layout JAVA

前端 未结 4 1194
刺人心
刺人心 2021-01-07 03:46

is there any sort of XY-Layout to Java?

So I can set a Button at the X and Y cordinate and that it is suppose to be that big etc.... Because this border layout and

4条回答
  •  时光取名叫无心
    2021-01-07 04:31

    The reason components resize is so stuff looks nice whatever size the window is, so Swing discourages straight X-Y position. You might want to have a look at GroupLayout http://java.sun.com/docs/books/tutorial/uiswing/layout/group.html which is designed for GUI builders, and the page mentioned above describes using invisible components to absorb the stretches. eg:layout.setAutoCreateGaps(true);

    SpringLayout might also be useful - see the visual guide

    If you really want X and Y then set the layout manager to null, and use setLocation() or setBounds(). I REALLY REALLY wouldn't recommend this, but it does work. Have a read of this tutorial

提交回复
热议问题