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).

!7

lib 1400521 // FlatLAF

p {
  com.formdev.flatlaf.FlatLightLaf.setup();
  
  var screens = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices();
  System.out.println("Detected " + screens.length + " screen(s)");
  for (int iScreen = 0; iScreen < screens.length; iScreen++) {
    var screen = screens[iScreen].getDefaultConfiguration().getBounds();
    
    // place window in center of screen
    new JWindow window;
    window.setBounds(
      screen.x+screen.width/4,
      screen.y+screen.height/4,
      screen.width/2,
      screen.height/2);
      
    // faint (mostly translucent) blue background
    window.setBackground(new Color(0, 0, 255, 64));
    
    window.setAlwaysOnTop(true);
    var label = new JLabel("Screen " + (iScreen+1) + " of " + screens.length);
    label.setHorizontalAlignment(JLabel.CENTER);
    window.add(label);
    window.setVisible(true);
  }
    
  System.out.println("Will exit in 10");
  Thread.sleep(10000);
  System.exit(0);
}

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: 269 / 1079
Referenced in: