Libraryless. Click here for Pure Java version (9229L/51K).
sclass VerticalCenterLayout > AbstractLayoutManager { public void layoutContainer(Container parent) { L<Component> components = getComponents(parent); if (l(components) > 1) ret with print("VerticalCenterLayout fail"); Component c = first(components); if (c == null) ret; int w = parent.getWidth(), h = parent.getHeight(); Dimension size = c.getPreferredSize(); int y = (h-size.height)/2; c.setBounds(0, y, w, size.height); preferredSize(size); } }
Began life as a copy of #1035946
download show line numbers debug dex old transpilations
Travelled to 2 computer(s): elmgxqgtpvxh, mqqgnosmbjvj
No comments. add comment
| Snippet ID: | #1036087 |
| Snippet name: | VerticalCenterLayout [works only with at most one component] |
| Eternal ID of this version: | #1036087/3 |
| Text MD5: | 8df28778f4c48249976cf57dd076a518 |
| Transpilation MD5: | 947e5324a36fa51a5aeaa2ecc82c85b1 |
| Author: | stefan |
| Category: | javax / gui |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2022-09-07 05:50:09 |
| Source code size: | 521 bytes / 17 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 564 / 667 |
| Version history: | 2 change(s) |
| Referenced in: | [show references] |