Libraryless. Click here for Pure Java version (4960L/28K).
1 | sclass TranslucentWindowTest { |
2 | new L<JWindow> windows; |
3 | |
4 | run { |
5 | var screens = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices(); |
6 | System.out.println("Detected " + screens.length + " screen(s)"); |
7 | for (int iScreen = 0; iScreen < screens.length; iScreen++) { |
8 | var screen = screens[iScreen].getDefaultConfiguration().getBounds(); |
9 | |
10 | // place window in center of screen |
11 | new JWindow window; |
12 | window.setBounds( |
13 | screen.x+screen.width/4, |
14 | screen.y+screen.height/4, |
15 | screen.width/2, |
16 | screen.height/2); |
17 | |
18 | // faint (mostly translucent) blue background |
19 | window.setBackground(new Color(0, 0, 255, 64)); |
20 | |
21 | window.setAlwaysOnTop(true); |
22 | var label = new JLabel("Screen " + (iScreen+1) + " of " + screens.length); |
23 | label.setHorizontalAlignment(JLabel.CENTER); |
24 | window.add(label); |
25 | window.setVisible(true); |
26 | windows.add(window); |
27 | } |
28 | |
29 | doAfter(10.0, r { |
30 | disposeWindows(windows); |
31 | }); |
32 | } |
33 | } |
Began life as a copy of #1034002
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1034004 |
Snippet name: | TranslucentWindowTest |
Eternal ID of this version: | #1034004/1 |
Text MD5: | 1f6c0a9cd30da2a915f1d271a8ff543e |
Transpilation MD5: | 3a666ff446bbf85ef5951ae4035679a9 |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-01-16 18:05:56 |
Source code size: | 1064 bytes / 33 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 147 / 284 |
Referenced in: | [show references] |