|
|
|
@ -153,7 +153,7 @@ public class FRGUIPaneFactory {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static LayoutManager createCenterLayout(JComponent centerBody) { |
|
|
|
|
return createCenterLayout(centerBody, 0.3d); |
|
|
|
|
return createCenterLayout(centerBody, 0.5d, 0.3d); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -162,7 +162,7 @@ public class FRGUIPaneFactory {
|
|
|
|
|
* @param centerBody 中心组件 |
|
|
|
|
* @return 布局方式 |
|
|
|
|
*/ |
|
|
|
|
public static LayoutManager createCenterLayout(JComponent centerBody, double factor) { |
|
|
|
|
public static LayoutManager createCenterLayout(JComponent centerBody, double factorX, double factorY) { |
|
|
|
|
|
|
|
|
|
return new LayoutManager() { |
|
|
|
|
|
|
|
|
@ -188,8 +188,8 @@ public class FRGUIPaneFactory {
|
|
|
|
|
// 这个时候大小是不确定的
|
|
|
|
|
int bodyWidth = centerBody.getPreferredSize().width; |
|
|
|
|
int bodyHeight = centerBody.getPreferredSize().height; |
|
|
|
|
int labelX = (width - bodyWidth) / 2; |
|
|
|
|
int labelY = (int) ((height - bodyHeight) * factor); |
|
|
|
|
int labelX = (int) ((width - bodyWidth) * factorX); |
|
|
|
|
int labelY = (int) ((height - bodyHeight) * factorY); |
|
|
|
|
centerBody.setBounds(labelX, labelY, bodyWidth, bodyHeight); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|