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

24
LINES

< > BotCompany Repo | #1014538 - jCenteredBackgroundImage

JavaX fragment (include)

static JPanel jCenteredBackgroundImage(S imageID) {
  ret jCenteredBackgroundImage(loadImage2(imageID));
}

static JPanel jCenteredBackgroundImage(final BufferedImage image) {
  ret swing(func -> JPanel { ret new JPanel {
    protected void paintComponent(Graphics g) {  
      paintCenteredBackgroundImage(this, g, image);
    }
  }; });
}
  
static JPanel jCenteredBackgroundImage(S imageID, Component contents) {
  ret jCenteredBackgroundImage(loadImage2(imageID), contents);
}
  
static JPanel jCenteredBackgroundImage(final BufferedImage image, final Component contents) {
  ret swing(func -> JPanel {
    JPanel panel = jCenteredBackgroundImage(image);
    panel.setLayout(new BorderLayout);
    panel.add(BorderLayout.CENTER, jtransparent_recursive(contents));
    ret panel;
  });
}

Author comment

Began life as a copy of #1006894

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: #1014538
Snippet name: jCenteredBackgroundImage
Eternal ID of this version: #1014538/2
Text MD5: f17fd39c69ed9eb6ae3623da51f0db09
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-04-23 19:29:21
Source code size: 813 bytes / 24 lines
Pitched / IR pitched: No / No
Views / Downloads: 257 / 280
Version history: 1 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1014538 & http://1014538.tinybrain.de