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

!7

set flag LeanMode.
//set flag Reparse.

p {
  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);
}

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: 244 / 908
Version history: 9 change(s)
Referenced in: #1034003 - Translucent JWindow multi-screen bug demo with FlatLaf
#1034004 - TranslucentWindowTest
#1034015 - Artificial mouse pointer test
#1034016 - Translucent JWindow multi-screen bug demo 2 [finally shows the bug]