1 | static void paintCenteredBackgroundImage(Component c, Graphics g, BufferedImage image) {
|
2 | paintCenteredBackgroundImage(c, g, image, c.getBackground()); |
3 | } |
4 | |
5 | static void paintCenteredBackgroundImage(Component c, Graphics g, BufferedImage image, Color backgroundColor) {
|
6 | int w = c.getWidth(); |
7 | int h = c.getHeight(); |
8 | g.setColor(backgroundColor); |
9 | g.fillRect(0, 0, w, h); |
10 | if (image == null) ret; |
11 | int iw = image.getWidth(), ih = image.getHeight(); |
12 | g.drawImage(image, (w-iw)/2, (h-ih)/2, c); |
13 | } |
Began life as a copy of #1009941
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1014537 |
| Snippet name: | paintCenteredBackgroundImage |
| Eternal ID of this version: | #1014537/5 |
| Text MD5: | bc9a929492d3bd9cd08837cee93e464d |
| Author: | stefan |
| Category: | javax / gui |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2018-06-11 13:27:12 |
| Source code size: | 513 bytes / 13 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 664 / 712 |
| Version history: | 4 change(s) |
| Referenced in: | [show references] |