Libraryless. Click here for Pure Java version (8731L/56K).
// Note: Doesn't show anything if are is not completely in allowed bounds static JWindow freeFloatingAnimation(S imageID, int x, int y, double seconds) { ret disposeWindowAfter(iround(seconds*1000), freeFloatingAnimation(imageID, x, y)); } static JWindow freeFloatingAnimation(final S imageID, final int x, final int y) { ret (JWindow) swingAndWait(func { JLabel label = new JLabel(imageIcon(imageID)); label.setOpaque(false); new JWindow w; w.setLocation(x, y); w.add(label); // add it to get appropriate size through pack() w.pack(); Rectangle maxBounds = maxWindowBounds(); Rectangle r = w.getBounds(); if (!maxBounds.contains(r)) null; /*w.setLocation( max(0, min(x, maxBounds.x+maxBounds.width-w.getWidth())), max(0, min(y, maxBounds.y+maxBounds.height-w.getHeight())));*/ Rectangle r2 = intersectWithScreen(r); BufferedImage background = shootScreen2(r2); //w.setLayout(null); w.remove(label); new JLayeredPane layeredPane; Rectangle bounds = new Rectangle(0, 0, w.getContentPane().getWidth(), w.getContentPane().getHeight()); w.add(layeredPane); JLabel lBackground = new JLabel(imageIcon(background)); lBackground.setBounds(0, 0, r2.width, r2.height); layeredPane.add(lBackground, boxed(1)); label.setBounds(bounds); layeredPane.add(label, new Int(2)); revalidate(w); w.setAlwaysOnTop(true); w.setVisible(true); ret w; }); }
Began life as a copy of #1005622
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1005626 |
Snippet name: | freeFloatingAnimation |
Eternal ID of this version: | #1005626/2 |
Text MD5: | 3dcd98997278e9e8e927706779adb758 |
Transpilation MD5: | dcedc26da371a2f18e9b5e533b90235a |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-10-01 23:25:07 |
Source code size: | 1509 bytes / 41 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 602 / 633 |
Version history: | 1 change(s) |
Referenced in: | [show references] |