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)

1  
sclass DesktopPaneWithFitPicture_smooth_cacheScaled extends JDesktopPane {
2  
  BufferedImage image, originalImage, scaled;
3  
  *() {}
4  
  *(BufferedImage *image) {}
5  
  
6  
  protected void paintComponent(Graphics g) {  
7  
    if (image == null) { originalImage = scaled = null; }
8  
    else {
9  
      Pt size = calcFitSize(image, this);
10  
      if (image != originalImage || scaled == null || scaled.getWidth() != size.x || scaled.getHeight() != size.y) {
11  
        _print("Scaling image");
12  
        originalImage = image;
13  
        scaled = resizeImage(image, size.x, size.y);
14  
      }
15  
    }
16  
    paintCenteredBackgroundImage(this, g, scaled);
17  
  }
18  
  
19  
  void setImage(BufferedImage image) { this.image = image; repaint(); }
20  
}

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: 326 / 843
Version history: 3 change(s)
Referenced in: [show references]