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

34
LINES

< > BotCompany Repo | #1034003 // Translucent JWindow multi-screen bug demo with FlatLaf

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

Download Jar. Uses 550K of libraries. Click here for Pure Java version (62L/1K).

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

Author comment

Began life as a copy of #1034002

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1034003
Snippet name: Translucent JWindow multi-screen bug demo with FlatLaf
Eternal ID of this version: #1034003/1
Text MD5: 5971da2be53ecf3c798f4d243379f398
Transpilation MD5: fa22af843166dfd1cc4c7b3b2dae4cc2
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:03:32
Source code size: 1020 bytes / 34 lines
Pitched / IR pitched: No / No
Views / Downloads: 120 / 696
Referenced in: [show references]