panelcomponent: add override for panel resizing. (#2535)

This commit is contained in:
Ganom
2020-04-30 12:04:05 -04:00
committed by GitHub
parent 2ba06b96ad
commit 4fa0885e12

View File

@@ -61,6 +61,9 @@ public class PanelComponent implements LayoutableRenderableEntity
@Setter
private boolean wrap = false;
@Setter
private boolean overrideResize = false;
@Setter
private Rectangle border = new Rectangle(
ComponentConstants.STANDARD_BORDER,
@@ -131,6 +134,11 @@ public class PanelComponent implements LayoutableRenderableEntity
}
}
if (overrideResize)
{
child.setPreferredSize(childPreferredSize);
}
child.setPreferredLocation(new Point(x, y));
final Dimension childDimension = child.render(graphics);
@@ -206,4 +214,4 @@ public class PanelComponent implements LayoutableRenderableEntity
bounds.setSize(dimension);
return dimension;
}
}
}