Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

26
LINES

< > BotCompany Repo | #1019383 // Tray Area Test v1 [Dyn Module, doesn't work anymore]

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Libraryless. Click here for Pure Java version (14623L/100K).

1  
!7
2  
3  
module TrayAreaTest > DynPrintLog {
4  
  start {
5  
    final JPanel trayArea = dm_getOSOpt('trayArea);
6  
    if (trayArea == null) ret with print("No tray area");
7  
    print("Got tray area. Setting contents.");
8  
    swing {
9  
      removeAllComponents(trayArea);
10  
      trayArea.setLayout(new BorderLayout);
11  
      JLabel label = jcenteredlabel("Hello world!");
12  
      trayArea.add(label, BorderLayout.CENTER);
13  
      trayArea.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 20));
14  
      revalidate(trayArea);
15  
      Dimension size = label.getPreferredSize();
16  
      print("Minimum size: " + size);
17  
      Dimension parentSize;
18  
      print("Parent size: " + (parentSize = trayArea.getParent().getSize()));
19  
      //print("height: ", trayArea.getHeight());
20  
      int h = parentSize.height;
21  
      setPreferredSize(trayArea, size.width, size.height);
22  
      revalidate(trayArea.getParent());
23  
    }
24  
    print("Done.");
25  
  }
26  
}

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: 427 / 597
Version history: 16 change(s)
Referenced in: [show references]