Libraryless. Click here for Pure Java version (14623L/100K).
!7 module TrayAreaTest > DynPrintLog { start { final JPanel trayArea = dm_getOSOpt('trayArea); if (trayArea == null) ret with print("No tray area"); print("Got tray area. Setting contents."); swing { removeAllComponents(trayArea); trayArea.setLayout(new BorderLayout); JLabel label = jcenteredlabel("Hello world!"); trayArea.add(label, BorderLayout.CENTER); trayArea.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 20)); revalidate(trayArea); Dimension size = label.getPreferredSize(); print("Minimum size: " + size); Dimension parentSize; print("Parent size: " + (parentSize = trayArea.getParent().getSize())); //print("height: ", trayArea.getHeight()); int h = parentSize.height; setPreferredSize(trayArea, size.width, size.height); revalidate(trayArea.getParent()); } print("Done."); } }
download show line numbers debug dex old transpilations
Travelled to 12 computer(s): bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1019383 |
Snippet name: | Tray Area Test v1 [Dyn Module, doesn't work anymore] |
Eternal ID of this version: | #1019383/17 |
Text MD5: | db926aa8dba2ef1d7424a1d300ded29d |
Transpilation MD5: | 71ef1914c68bea8d4e99422e467a4647 |
Author: | stefan |
Category: | javax / stefan's os |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-11-04 19:06:54 |
Source code size: | 931 bytes / 26 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 426 / 596 |
Version history: | 16 change(s) |
Referenced in: | #1019386 - Tray Area Test v2 [Dyn Module, OK, but don't use] |