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

20
LINES

< > BotCompany Repo | #1019845 // DesktopPaneWithFitPicture_smooth_cacheScaled

JavaX fragment (include)

sclass DesktopPaneWithFitPicture_smooth_cacheScaled extends JDesktopPane {
  BufferedImage image, originalImage, scaled;
  *() {}
  *(BufferedImage *image) {}
  
  protected void paintComponent(Graphics g) {  
    if (image == null) { originalImage = scaled = null; }
    else {
      Pt size = calcFitSize(image, this);
      if (image != originalImage || scaled == null || scaled.getWidth() != size.x || scaled.getHeight() != size.y) {
        _print("Scaling image");
        originalImage = image;
        scaled = resizeImage(image, size.x, size.y);
      }
    }
    paintCenteredBackgroundImage(this, g, scaled);
  }
  
  void setImage(BufferedImage image) { this.image = image; repaint(); }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 9 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1019845
Snippet name: DesktopPaneWithFitPicture_smooth_cacheScaled
Eternal ID of this version: #1019845/4
Text MD5: 66424b8482d9f479c42a25790bacdf8a
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-11-28 20:00:06
Source code size: 723 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 324 / 840
Version history: 3 change(s)
Referenced in: [show references]