use of org.apache.pivot.wtk.Dimensions in project pivot by apache.
the class FakeWindowSkin method getPreferredSize.
@Override
public Dimensions getPreferredSize() {
int preferredWidth = 0;
int preferredHeight = 0;
FakeWindow frame = (FakeWindow) getComponent();
// Include title bar width plus left/right title bar borders
Dimensions titleBarSize = titleBarTablePane.getPreferredSize();
preferredWidth = Math.max(preferredWidth, titleBarSize.width + 2);
// Include title bar height plus top/bottom title bar borders
preferredHeight += titleBarSize.height + 2;
Component content = frame.getContent();
if (content != null) {
Dimensions preferredContentSize = content.getPreferredSize();
preferredWidth = Math.max(preferredWidth, preferredContentSize.width);
preferredHeight += preferredContentSize.height;
}
// Add padding, borders, and content bevel
preferredWidth += padding.getWidth() + 2;
preferredHeight += padding.getHeight() + (1) + 2;
return new Dimensions(preferredWidth, preferredHeight);
}
Aggregations