You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
931 B
31 lines
931 B
package com.tptj.tool.hg.fineui.swing.element.layout.impl; |
|
|
|
import com.tptj.tool.hg.fineui.swing.element.AbstractElement; |
|
import com.tptj.tool.hg.fineui.swing.element.Element; |
|
|
|
import java.awt.*; |
|
import java.util.List; |
|
|
|
public class HorizontalLayout extends FlowLayout { |
|
private Element element; |
|
|
|
public HorizontalLayout(Element target, int align, int hgap, int vgap) { |
|
super(align, hgap, vgap); |
|
element = target; |
|
} |
|
|
|
@Override |
|
public Dimension preferredLayoutSize(Container parent) { |
|
Dimension dim = super.preferredLayoutSize(parent); |
|
return BaseFineUILayout.preferredLayoutSize(element, dim); |
|
} |
|
|
|
@Override |
|
public void layoutContainer(Container parent) { |
|
super.layoutContainer(parent); |
|
List<AbstractElement> children = element.children(); |
|
for (Element child : children) { |
|
BaseFineUILayout.optimiseElement(child); |
|
} |
|
} |
|
}
|
|
|