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

25
LINES

< > BotCompany Repo | #1013349 // blinkingRedText

JavaX fragment (include)

1  
static float blinkingRedText_fontSize = 80f;
2  
3  
import java.awt.font.*;
4  
import java.awt.geom.*;
5  
6  
static JWindow blinkingRedText(fS text, final int howOften) {
7  
  ret swing(func -> JWindow {
8  
    JPanel panel = singleColorPanel(Color.RED);
9  
    new JWindow w;
10  
    w.add(panel);
11  
    w.setAlwaysOnTop(true);
12  
    w.setVisible(true);
13  
    
14  
    TextLayout tl = new TextLayout(text, w.getFont().deriveFont(Font.BOLD, blinkingRedText_fontSize),
15  
      ((Graphics2D) w.getGraphics()).getFontRenderContext());
16  
    Rectangle2D r = tl.getBounds();
17  
    new AffineTransform tx;
18  
    tx.translate(0, r.getHeight());
19  
    Shape outline = tl.getOutline(tx);
20  
    centerWindow(w, iceil(r.getWidth()), iceil(r.getHeight()));
21  
    w.setShape(outline);
22  
    blinkWindowUsingSize(w, howOften);
23  
    ret w;
24  
  });
25  
}

Author comment

Began life as a copy of #1013348

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1013349
Snippet name: blinkingRedText
Eternal ID of this version: #1013349/6
Text MD5: 5fdef5edab30dd2eb87eda5cf0c6c534
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-01-02 23:34:54
Source code size: 802 bytes / 25 lines
Pitched / IR pitched: No / No
Views / Downloads: 378 / 450
Version history: 5 change(s)
Referenced in: [show references]