Uses 110K of libraries. Click here for Pure Java version (1093L/7K/28K).
1 | !7 |
2 | |
3 | lib 1007242 // TableLayout |
4 | |
5 | import layout.TableLayout; |
6 | |
7 | p-awt-noconsole { |
8 | // Create a frame |
9 | JFrame frame = new JFrame("Example of TableLayout"); |
10 | frame.setBounds(100, 100, 300, 300); |
11 | |
12 | // Create a TableLayout for the frame |
13 | double border = 10; |
14 | double size[][] = |
15 | {{border, 0.10, 20, TableLayout.FILL, 20, 0.20, border}, // Columns |
16 | {border, 0.20, 20, TableLayout.FILL, 20, 0.20, border}}; // Rows |
17 | |
18 | frame.getContentPane().setLayout(new TableLayout(size)); |
19 | |
20 | // Create some buttons |
21 | String label[] = {"Top", "Bottom", "Left", "Right", "Center", "Overlap"}; |
22 | Button button[] = new Button[label.length]; |
23 | |
24 | for (int i = 0; i < label.length; i++) |
25 | button[i] = new Button(label[i]); |
26 | |
27 | // Add buttons |
28 | frame.add (button[0], "1, 1, 5, 1"); // Top |
29 | frame.add (button[1], "1, 5, 5, 5"); // Bottom |
30 | frame.add (button[2], "1, 3 "); // Left |
31 | frame.add (button[3], "5, 3 "); // Right |
32 | frame.add (button[4], "3, 3, c, c"); // Center |
33 | frame.add (button[5], "3, 3, 3, 5"); // Overlap |
34 | |
35 | // Show frame |
36 | frame.show(); |
37 | } |
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1007243 |
Snippet name: | Test TableLayout |
Eternal ID of this version: | #1007243/4 |
Text MD5: | 05e1d93c3a9569715bdf8bf449ad0b3e |
Transpilation MD5: | d6ddc6c3e5dee44388114a6e70100beb |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-03-22 21:10:47 |
Source code size: | 1089 bytes / 37 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 408 / 490 |
Version history: | 3 change(s) |
Referenced in: | [show references] |