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

25
LINES

< > BotCompany Repo | #1013349 // blinkingRedText

JavaX fragment (include)

static float blinkingRedText_fontSize = 80f;

import java.awt.font.*;
import java.awt.geom.*;

static JWindow blinkingRedText(fS text, final int howOften) {
  ret swing(func -> JWindow {
    JPanel panel = singleColorPanel(Color.RED);
    new JWindow w;
    w.add(panel);
    w.setAlwaysOnTop(true);
    w.setVisible(true);
    
    TextLayout tl = new TextLayout(text, w.getFont().deriveFont(Font.BOLD, blinkingRedText_fontSize),
      ((Graphics2D) w.getGraphics()).getFontRenderContext());
    Rectangle2D r = tl.getBounds();
    new AffineTransform tx;
    tx.translate(0, r.getHeight());
    Shape outline = tl.getOutline(tx);
    centerWindow(w, iceil(r.getWidth()), iceil(r.getHeight()));
    w.setShape(outline);
    blinkWindowUsingSize(w, howOften);
    ret w;
  });
}

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: 377 / 449
Version history: 5 change(s)
Referenced in: [show references]