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

57
LINES

< > BotCompany Repo | #1015431 // showImage_hcentered - align = center, valign = top - TODO

JavaX fragment (include)

1  
please include function showImage.
2  
3  
static ImageSurface showImage_hcentered(final BufferedImage img) {
4  
  ret (ImageSurface) swing(func {
5  
    ImageSurface is = new ImageSurface(img);
6  
    JFrame frame = showPackedFrame(new JScrollPane(vstack(jfullcenter(is))));
7  
    frameIcon(frame, showImage_defaultIcon);
8  
    return is;
9  
  });
10  
}
11  
12  
static ImageSurface showImage_hcentered(final BufferedImage img, fS title) {
13  
  ret setFrameTitle(showImage_hcentered(img), title);
14  
}
15  
16  
static ImageSurface showImage_hcentered(S title, BufferedImage img) {
17  
  ret showImage_hcentered(img, title);
18  
}
19  
20  
static ImageSurface showImage_hcentered(S title, RGBImage img) {
21  
  return showImage_hcentered(title, img.getBufferedImage());
22  
}
23  
24  
static ImageSurface showImage_hcentered(ImageSurface is, BufferedImage img) {
25  
  if (is == null) ret showImage_hcentered(img);
26  
  is.setImage(img);
27  
  ret is;
28  
}
29  
30  
// make or update the ImageSurface
31  
static ImageSurface showImage_hcentered(ImageSurface is, S title, BufferedImage img) {
32  
  if (is == null) ret showImage_hcentered(title, img);
33  
  is.setImage(img);
34  
  setFrameTitle(is, title);
35  
  ret is;
36  
}
37  
38  
static ImageSurface showImage_hcentered(ImageSurface surface, RGBImage img, S title) {
39  
  ret setFrameTitle(showImage_hcentered(img, surface), title);
40  
}
41  
42  
static ImageSurface showImage_hcentered(RGBImage img, ImageSurface surface) {
43  
  if (surface == null)
44  
    ret showImage_hcentered(img);
45  
  else {
46  
    surface.setImage(img);
47  
    ret surface;
48  
  }
49  
}
50  
51  
static ImageSurface showImage_hcentered(RGBImage img) {
52  
  return showImage_hcentered(img.getBufferedImage());
53  
}
54  
55  
static ImageSurface showImage_hcentered(ImageSurface surface, S title, RGBImage img) {
56  
  ret showImage_hcentered(surface, img, title);
57  
}

Author comment

Began life as a copy of #1006689

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: #1015431
Snippet name: showImage_hcentered - align = center, valign = top - TODO
Eternal ID of this version: #1015431/4
Text MD5: cf8071d486781a332485459cb4fa8662
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-05-13 22:34:10
Source code size: 1756 bytes / 57 lines
Pitched / IR pitched: No / No
Views / Downloads: 327 / 364
Version history: 3 change(s)
Referenced in: [show references]