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

33
LINES

< > BotCompany Repo | #1034002 // Translucent JWindow multi-screen bug demo - no bug to be found anymore

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Libraryless. Click here for Pure Java version (57L/1K).

1  
!7
2  
3  
set flag LeanMode.
4  
//set flag Reparse.
5  
6  
p {
7  
  var screens = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices();
8  
  System.out.println("Detected " + screens.length + " screen(s)");
9  
  for (int iScreen = 0; iScreen < screens.length; iScreen++) {
10  
    var screen = screens[iScreen].getDefaultConfiguration().getBounds();
11  
    
12  
    // place window in center of screen
13  
    new JWindow window;
14  
    window.setBounds(
15  
      screen.x+screen.width/4,
16  
      screen.y+screen.height/4,
17  
      screen.width/2,
18  
      screen.height/2);
19  
      
20  
    // faint (mostly translucent) blue background
21  
    window.setBackground(new Color(0, 0, 255, 64));
22  
    
23  
    window.setAlwaysOnTop(true);
24  
    var label = new JLabel("Screen " + (iScreen+1) + " of " + screens.length);
25  
    label.setHorizontalAlignment(JLabel.CENTER);
26  
    window.add(label);
27  
    window.setVisible(true);
28  
  }
29  
    
30  
  System.out.println("Will exit in 10");
31  
  Thread.sleep(10000);
32  
  System.exit(0);
33  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1034002
Snippet name: Translucent JWindow multi-screen bug demo - no bug to be found anymore
Eternal ID of this version: #1034002/10
Text MD5: ff5b0391097cbf7ff88d1fe3153be032
Transpilation MD5: 462582356d5162578a8539df9839f9b7
Author: stefan
Category: javax / gui
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-01-16 18:09:42
Source code size: 988 bytes / 33 lines
Pitched / IR pitched: No / No
Views / Downloads: 243 / 908
Version history: 9 change(s)
Referenced in: [show references]